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 Mar 4, 2024
1 parent ae58efd commit 5348bbd
Show file tree
Hide file tree
Showing 10 changed files with 54 additions and 14 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.3.0
_commit: v2.5.1
_src_path: gh:kc-workspace/asdf-plugin-template.git
addon_yaml:
archive: true
Expand Down
2 changes: 2 additions & 0 deletions .github/linters/cspell-default.dict.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@ envops
venv
keyid
kwargs
cmd
cmds
17 changes: 17 additions & 0 deletions .github/release-please/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"$schema": "https://github.com/googleapis/release-please/raw/main/schemas/config.json",
"changelog-type": "github",
"changelog-sections": [
{ "type": "feat", "section": "Features", "hidden": false },
{ "type": "perf", "section": "Improvements", "hidden": false },
{ "type": "fix", "section": "Bugfixes", "hidden": false },
{ "type": "docs", "section": "Documentation", "hidden": false },
{ "type": "revert", "section": "Reverts", "hidden": false },
{ "type": "chore", "section": "Miscellaneous", "hidden": false },
{ "type": "refactor", "section": "Code Refactoring", "hidden": true },
{ "type": "test", "section": "Tests", "hidden": true },
{ "type": "build", "section": "Build System", "hidden": true },
{ "type": "ci", "section": "Continuous Integration", "hidden": true }
],
"packages": {}
}
10 changes: 2 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,7 @@ jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: google-github-actions/release-please-action@v3
- uses: google-github-actions/release-please-action@v4
with:
release-type: simple
changelog-types: |
[
{"type":"feat","section":"Features","hidden":false},
{"type":"perf","section":"Improvements","hidden":false},
{"type":"fix","section":"Bugfixes","hidden":false},
{"type":"chore","section":"Miscellaneous","hidden":false}
]
config-file: .github/release-please/config.json
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 Kamontat Chantrachirathumrong
Copyright (c) 2024 Kamontat Chantrachirathumrong

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
4 changes: 3 additions & 1 deletion lib/bin/help-overview.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ __asdf_bin() {
_kc_asdf_custom_help
else
echo "$KC_ASDF_APP_DESC"
echo

kc_asdf_optional kc_asdf_help_header "Commands"
echo "$KC_ASDF_APP_CMDS"
fi
}
20 changes: 20 additions & 0 deletions lib/commands/command-version.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash

## https://asdf-vm.com/plugins/create.html#extension-commands-for-asdf-cli

## Show dev version when version.txt is exist but no content
## Show missing version when version.txt is missing
kc_asdf_main() {
local plugin_path=""
plugin_path="$(cd "$(dirname "$0")/../.." && pwd)"

local version_file="version.txt" version=""
if [ -f "$plugin_path/$version_file" ]; then
version="$(cat "$plugin_path/${version_file}")"
[ -z "$version" ] && version="dev"
fi

printf '%s: %s\n' "$(basename "$plugin_path")" "${version:-missing}"
}

kc_asdf_main
5 changes: 3 additions & 2 deletions lib/common/defaults.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@ kc_asdf_exec() {
## usage: `kc_asdf_optional echo 'run'`
kc_asdf_optional() {
if ! command -v "$1" >/dev/null; then
kc_asdf_debug "optional.defaults" "command %s missing, silently ignored" \
"$1"
kc_asdf_debug "optional.defaults" \
"command %s missing, silently ignored" "$1"
return 0
fi

kc_asdf_exec "$@"
Expand Down
6 changes: 5 additions & 1 deletion lib/common/index.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,14 @@ KC_ASDF_APP_TYPE="standalone"
KC_ASDF_APP_NAME="yq"
KC_ASDF_APP_WEBS="https://mikefarah.gitbook.io/yq/"
KC_ASDF_APP_DESC="a portable command-line YAML, JSON, XML, CSV, TOML and properties processor"
KC_ASDF_APP_CMDS="
- test - test if cli exist and executable
- version - print *plugin* version
"
KC_ASDF_APP_REPO="https://github.com/mikefarah/yq"
export KC_ASDF_APP_TYPE KC_ASDF_APP_NAME
export KC_ASDF_APP_WEBS KC_ASDF_APP_DESC
export KC_ASDF_APP_REPO
export KC_ASDF_APP_CMDS KC_ASDF_APP_REPO

# shellcheck source-path=SCRIPTDIR/internal.sh
source "${KC_ASDF_PLUGIN_PATH:?}/lib/common/internal.sh" || exit 1
Expand Down
Empty file added version.txt
Empty file.

0 comments on commit 5348bbd

Please sign in to comment.