Skip to content

Commit

Permalink
perf: update plugin from template [autocommit]
Browse files Browse the repository at this point in the history
  • Loading branch information
kamontat committed Sep 17, 2023
1 parent 1b06acb commit aa8a6a6
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
## Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
_commit: v2.2.2
_commit: v2.2.3
_src_path: gh:kc-workspace/asdf-plugin-template.git
addon_yaml:
archive: true
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Running cspell
uses: streetsidesoftware/cspell-action@v3
with:
Expand All @@ -39,7 +39,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Linting
Expand Down
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ how to install & manage versions.
Plugins generated from asdf-plugin-template repository will
contains several extra features for every user including all below.

- `$DEBUG=<any-string>` to enabled debug mode
- `$DEBUG=<any-string>` to enabled debug mode (debug logs will guarantee to show regardless of other settings)
- `$ASDF_FORCE_DOWNLOAD=<any-string>` to always download even cache exist
- `$ASDF_INSECURE=<any-string>` to disable security features (e.g. checksum)
- `$ASDF_NO_CHECK=<any-string>` to disable pre-check features (e.g. check-cmd)
Expand All @@ -97,20 +97,23 @@ contains several extra features for every user including all below.
- **{namespace}** - for formatted namespace (always have same length)
- **{ns}** - for raw namespace (no formatting applied)
- **{message}** - for log message
- `$ASDF_LOG_QUIET=<any-string>` - to disable only info logs
- `$ASDF_LOG_SILENT=<any-string>` - to disable all logs (including warning and error)

### Addition Features

The plugins might contains additional features
in addition to default features above.
You can take a look at [README.plugin.md][app-readme]
You can take a look at [README.plugin.md][app-readme-md]

## Contributors

Read [CONTRIBUTING.md] file for more detail.
Read [CONTRIBUTING.md][contributing-md] file for more detail.

<!-- LINKS SECTION -->

[app-readme]: ./README.plugin.md
[app-readme-md]: ./README.plugin.md
[contributing-md]: ./CONTRIBUTING.md
[plugin-gh]: https://github.com/kc-workspace/asdf-hyperfine
[template-gh]: https://github.com/kc-workspace/asdf-plugin-template
[asdf-link]: https://github.com/asdf-vm/asdf
Expand Down
12 changes: 12 additions & 0 deletions lib/common/internal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,22 @@ __asdf_load() {
## usage: `kc_asdf_log '<level>' '<namespace>' '<format>' '<variables>'`
## variables:
## - ASDF_LOG_FORMAT="{datetime} [{level}] {namespace} - {message}"
## - ASDF_LOG_QUIET=true
## - ASDF_LOG_SILENT=true
__asdf_log() {
local level="$1" ns="$2" _format="$3"
shift 3

case "$level" in
## disable info logs if log_quiet or log_silent is set
"INF")
test -n "${ASDF_LOG_QUIET:-}" || test -n "${ASDF_LOG_SILENT:-}" &&
return 0
;;
"WRN") test -n "${ASDF_LOG_SILENT:-}" && return 0 ;;
"ERR") test -n "${ASDF_LOG_SILENT:-}" && return 0 ;;
esac

local default="{time} [{level}] {namespace} - {message}"
local template="${ASDF_LOG_FORMAT:-$default}"

Expand Down

0 comments on commit aa8a6a6

Please sign in to comment.