diff --git a/CHANGELOG.md b/CHANGELOG.md index a325db7..be79542 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.0.3] - 2026-02-15 + +### Fixed +- Removed deprecated `homebrew/cask-fonts` tap logic; font casks now live in the main `homebrew/cask` repository since Homebrew 4.3.0 + +### Added +- `--version` / `-v` flag to display the current version +- `--list-installed` / `-l` flag to list installed Nerd Fonts non-interactively +- `--list-available` / `-a` flag to list available Nerd Fonts non-interactively +- Updated shell completions (zsh, bash, fish) with new flags + ## [1.0.2] - 2025-12-28 ### Added @@ -41,6 +52,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Homebrew formula for easy installation - Logging to `~/.nerd-font-manager.log` +[1.0.3]: https://github.com/auge2u/uni-nerd-font/compare/v1.0.2...v1.0.3 [1.0.2]: https://github.com/auge2u/uni-nerd-font/compare/v1.0.1...v1.0.2 [1.0.1]: https://github.com/auge2u/uni-nerd-font/compare/v1.0.0...v1.0.1 [1.0.0]: https://github.com/auge2u/uni-nerd-font/releases/tag/v1.0.0 diff --git a/README.md b/README.md index 38fba9e..48ea79c 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,8 @@ A bash utility for managing [Nerd Fonts](https://www.nerdfonts.com/) on macOS vi - [Homebrew](https://brew.sh/) - [fzf](https://github.com/junegunn/fzf) (for CLI mode): `brew install fzf` +> **Note:** As of Homebrew 4.3.0, all font casks (previously in `homebrew/cask-fonts`) are now part of the main `homebrew/cask` repository. No additional tap is needed for fonts. + ## Installation ### Homebrew (Recommended) @@ -66,6 +68,15 @@ Then restart your shell or source the config file. # GUI mode - macOS native dialogs ./nerd-font-manager.sh --gui +# Show version +./nerd-font-manager.sh --version + +# List installed Nerd Fonts +./nerd-font-manager.sh --list-installed + +# List available Nerd Fonts +./nerd-font-manager.sh --list-available + # Show help ./nerd-font-manager.sh --help ``` diff --git a/completions/_nerd-font-manager b/completions/_nerd-font-manager index 7ac36bd..5cfb4d6 100644 --- a/completions/_nerd-font-manager +++ b/completions/_nerd-font-manager @@ -10,6 +10,9 @@ _nerd-font-manager() { options=( '(-c --cli)'{-c,--cli}'[Run in CLI mode with fzf (default)]' '(-g --gui)'{-g,--gui}'[Run in GUI mode with macOS dialogs]' + '(-v --version)'{-v,--version}'[Show version]' + '(-l --list-installed)'{-l,--list-installed}'[List installed Nerd Fonts]' + '(-a --list-available)'{-a,--list-available}'[List available Nerd Fonts]' '(-h --help)'{-h,--help}'[Show help message]' ) diff --git a/completions/nerd-font-manager.bash b/completions/nerd-font-manager.bash index a0bd91a..bdea2d7 100644 --- a/completions/nerd-font-manager.bash +++ b/completions/nerd-font-manager.bash @@ -6,7 +6,7 @@ _nerd_font_manager() { local cur opts COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" - opts="--cli -c --gui -g --help -h" + opts="--cli -c --gui -g --version -v --list-installed -l --list-available -a --help -h" if [[ ${cur} == -* ]]; then COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) diff --git a/completions/nerd-font-manager.fish b/completions/nerd-font-manager.fish index 2e42fa9..16b93e6 100644 --- a/completions/nerd-font-manager.fish +++ b/completions/nerd-font-manager.fish @@ -4,10 +4,16 @@ complete -c nerd-font-manager -f complete -c nerd-font-manager -s c -l cli -d 'Run in CLI mode with fzf (default)' complete -c nerd-font-manager -s g -l gui -d 'Run in GUI mode with macOS dialogs' +complete -c nerd-font-manager -s v -l version -d 'Show version' +complete -c nerd-font-manager -s l -l list-installed -d 'List installed Nerd Fonts' +complete -c nerd-font-manager -s a -l list-available -d 'List available Nerd Fonts' complete -c nerd-font-manager -s h -l help -d 'Show help message' # Also complete for the .sh version complete -c nerd-font-manager.sh -f complete -c nerd-font-manager.sh -s c -l cli -d 'Run in CLI mode with fzf (default)' complete -c nerd-font-manager.sh -s g -l gui -d 'Run in GUI mode with macOS dialogs' +complete -c nerd-font-manager.sh -s v -l version -d 'Show version' +complete -c nerd-font-manager.sh -s l -l list-installed -d 'List installed Nerd Fonts' +complete -c nerd-font-manager.sh -s a -l list-available -d 'List available Nerd Fonts' complete -c nerd-font-manager.sh -s h -l help -d 'Show help message' diff --git a/nerd-font-manager.sh b/nerd-font-manager.sh index 58003e2..f9e2d4a 100755 --- a/nerd-font-manager.sh +++ b/nerd-font-manager.sh @@ -4,6 +4,7 @@ # Config # ============================= +VERSION="1.0.3" LOG_FILE="$HOME/.nerd-font-manager.log" # Updated favorites (8 fonts) @@ -28,15 +29,7 @@ log_event() { echo "$(date '+%Y-%m-%d %H:%M:%S') | $action | $font" >> "$LOG_FILE" } -ensure_fonts_tap() { - if ! brew tap | grep -q "^homebrew/cask-fonts$"; then - echo "Adding Homebrew tap: homebrew/cask-fonts" - brew tap homebrew/cask-fonts - fi -} - get_available_fonts() { - ensure_fonts_tap brew search --casks nerd-font | grep "font-.*-nerd-font" } @@ -348,11 +341,35 @@ main() { --cli|-c|"") cli_mode ;; + --version|-v) + echo "nerd-font-manager $VERSION" + ;; + --list-installed|-l) + local installed + installed=$(get_installed_fonts) + if [ -z "$installed" ]; then + echo "No Nerd Fonts installed." + else + echo "$installed" + fi + ;; + --list-available|-a) + local available + available=$(get_available_fonts) + if [ -z "$available" ]; then + echo "No Nerd Fonts found." + else + echo "$available" + fi + ;; --help|-h) - echo "Usage: $0 [--cli|-c] [--gui|-g] [--help|-h]" - echo " --cli, -c Run in CLI mode with fzf (default)" - echo " --gui, -g Run in GUI mode with macOS dialogs" - echo " --help, -h Show this help message" + echo "Usage: $0 [--cli|-c] [--gui|-g] [--help|-h] [--version|-v]" + echo " --cli, -c Run in CLI mode with fzf (default)" + echo " --gui, -g Run in GUI mode with macOS dialogs" + echo " --version, -v Show version" + echo " --list-installed, -l List installed Nerd Fonts" + echo " --list-available, -a List available Nerd Fonts" + echo " --help, -h Show this help message" ;; *) echo "Unknown option: $1"