diff options
author | Christian Duerr <contact@christianduerr.com> | 2023-06-12 02:23:41 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-12 00:23:41 +0000 |
commit | bd4906722a1a026b01f06c94c33b13ff63a7e044 (patch) | |
tree | a2713a7b0a5fa23ec8b9055d7ed06f1cede62447 /extra/completions | |
parent | ea2c39e65d21728e0f04b0eafcec7153e4447cd5 (diff) | |
download | alacritty-bd4906722a1a026b01f06c94c33b13ff63a7e044.tar.gz alacritty-bd4906722a1a026b01f06c94c33b13ff63a7e044.zip |
Switch to TOML configuration format
This switches Alacritty's default configuration format from yaml to
toml. While yaml is still supported, it is done by converting it to toml
and should be removed entirely in the future.
All existing features were persisted based on my testing. Behavior
should not change much, though `--option` might have slightly different
behavior since the entire line is not interpreted as one line of toml.
A new `alacritty migrate` subcommand has been added which allows
automatic migration from yaml to toml. This also could be used as a
facility to automatically fix configuration file changes in the future.
Closes #6592.
Diffstat (limited to 'extra/completions')
-rw-r--r-- | extra/completions/_alacritty | 33 | ||||
-rw-r--r-- | extra/completions/alacritty.bash | 46 | ||||
-rw-r--r-- | extra/completions/alacritty.fish | 14 |
3 files changed, 87 insertions, 6 deletions
diff --git a/extra/completions/_alacritty b/extra/completions/_alacritty index c4f586bb..6f21f450 100644 --- a/extra/completions/_alacritty +++ b/extra/completions/_alacritty @@ -16,7 +16,7 @@ _alacritty() { local context curcontext="$curcontext" state line _arguments "${_arguments_options[@]}" \ '--embed=[X11 window ID to embed Alacritty within (decimal or hexadecimal with "0x" prefix)]:EMBED: ' \ -'--config-file=[Specify alternative configuration file \[default\: \$XDG_CONFIG_HOME/alacritty/alacritty.yml\]]:CONFIG_FILE:_files' \ +'--config-file=[Specify alternative configuration file \[default\: \$XDG_CONFIG_HOME/alacritty/alacritty.toml\]]:CONFIG_FILE:_files' \ '--socket=[Path for IPC socket creation]:SOCKET:_files' \ '*-o+[Override configuration file options \[example\: cursor.style=Beam\]]:OPTION: ' \ '*--option=[Override configuration file options \[example\: cursor.style=Beam\]]:OPTION: ' \ @@ -116,6 +116,21 @@ esac ;; esac ;; +(migrate) +_arguments "${_arguments_options[@]}" \ +'-c+[Path to the configuration file]:CONFIG_FILE:_files' \ +'--config-file=[Path to the configuration file]:CONFIG_FILE:_files' \ +'-d[Only output TOML config to stdout]' \ +'--dry-run[Only output TOML config to stdout]' \ +'-i[Do not recurse over imports]' \ +'--skip-imports[Do not recurse over imports]' \ +'--skip-renames[Do not move renamed fields to their new location]' \ +'-s[Do not output to STDOUT]' \ +'--silent[Do not output to STDOUT]' \ +'-h[Print help]' \ +'--help[Print help]' \ +&& ret=0 +;; (help) _arguments "${_arguments_options[@]}" \ ":: :_alacritty__help_commands" \ @@ -152,6 +167,10 @@ _arguments "${_arguments_options[@]}" \ ;; esac ;; +(migrate) +_arguments "${_arguments_options[@]}" \ +&& ret=0 +;; (help) _arguments "${_arguments_options[@]}" \ && ret=0 @@ -169,6 +188,7 @@ esac _alacritty_commands() { local commands; commands=( 'msg:Send a message to the Alacritty socket' \ +'migrate:Migrate the configuration file' \ 'help:Print this message or the help of the given subcommand(s)' \ ) _describe -t commands 'alacritty commands' commands "$@" @@ -207,6 +227,7 @@ _alacritty__msg__help__create-window_commands() { _alacritty__help_commands() { local commands; commands=( 'msg:Send a message to the Alacritty socket' \ +'migrate:Migrate the configuration file' \ 'help:Print this message or the help of the given subcommand(s)' \ ) _describe -t commands 'alacritty help commands' commands "$@" @@ -230,6 +251,16 @@ _alacritty__msg__help__help_commands() { local commands; commands=() _describe -t commands 'alacritty msg help help commands' commands "$@" } +(( $+functions[_alacritty__help__migrate_commands] )) || +_alacritty__help__migrate_commands() { + local commands; commands=() + _describe -t commands 'alacritty help migrate commands' commands "$@" +} +(( $+functions[_alacritty__migrate_commands] )) || +_alacritty__migrate_commands() { + local commands; commands=() + _describe -t commands 'alacritty migrate commands' commands "$@" +} (( $+functions[_alacritty__help__msg_commands] )) || _alacritty__help__msg_commands() { local commands; commands=( diff --git a/extra/completions/alacritty.bash b/extra/completions/alacritty.bash index bb70ef3f..f7f2caf1 100644 --- a/extra/completions/alacritty.bash +++ b/extra/completions/alacritty.bash @@ -15,12 +15,18 @@ _alacritty() { alacritty,help) cmd="alacritty__help" ;; + alacritty,migrate) + cmd="alacritty__migrate" + ;; alacritty,msg) cmd="alacritty__msg" ;; alacritty__help,help) cmd="alacritty__help__help" ;; + alacritty__help,migrate) + cmd="alacritty__help__migrate" + ;; alacritty__help,msg) cmd="alacritty__help__msg" ;; @@ -55,7 +61,7 @@ _alacritty() { case "${cmd}" in alacritty) - opts="-q -v -o -e -T -h -V --print-events --ref-test --embed --config-file --socket --option --working-directory --hold --command --title --class --help --version msg help" + opts="-q -v -o -e -T -h -V --print-events --ref-test --embed --config-file --socket --option --working-directory --hold --command --title --class --help --version msg migrate help" if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -113,7 +119,7 @@ _alacritty() { return 0 ;; alacritty__help) - opts="msg help" + opts="msg migrate help" if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -140,6 +146,20 @@ _alacritty() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; + alacritty__help__migrate) + opts="" + if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + fi + case "${prev}" in + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + ;; alacritty__help__msg) opts="create-window config" if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then @@ -182,6 +202,28 @@ _alacritty() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; + alacritty__migrate) + opts="-c -d -i -s -h --config-file --dry-run --skip-imports --skip-renames --silent --help" + if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + fi + case "${prev}" in + --config-file) + COMPREPLY=($(compgen -f "${cur}")) + return 0 + ;; + -c) + COMPREPLY=($(compgen -f "${cur}")) + return 0 + ;; + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + ;; alacritty__msg) opts="-s -h --socket --help create-window config help" if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then diff --git a/extra/completions/alacritty.fish b/extra/completions/alacritty.fish index 2d80be62..fe02ea82 100644 --- a/extra/completions/alacritty.fish +++ b/extra/completions/alacritty.fish @@ -1,5 +1,5 @@ complete -c alacritty -n "__fish_use_subcommand" -l embed -d 'X11 window ID to embed Alacritty within (decimal or hexadecimal with "0x" prefix)' -r -complete -c alacritty -n "__fish_use_subcommand" -l config-file -d 'Specify alternative configuration file [default: $XDG_CONFIG_HOME/alacritty/alacritty.yml]' -r -F +complete -c alacritty -n "__fish_use_subcommand" -l config-file -d 'Specify alternative configuration file [default: $XDG_CONFIG_HOME/alacritty/alacritty.toml]' -r -F complete -c alacritty -n "__fish_use_subcommand" -l socket -d 'Path for IPC socket creation' -r -F complete -c alacritty -n "__fish_use_subcommand" -s o -l option -d 'Override configuration file options [example: cursor.style=Beam]' -r complete -c alacritty -n "__fish_use_subcommand" -l working-directory -d 'Start the shell in the specified working directory' -r -F @@ -14,6 +14,7 @@ complete -c alacritty -n "__fish_use_subcommand" -l hold -d 'Remain open after c complete -c alacritty -n "__fish_use_subcommand" -s h -l help -d 'Print help' complete -c alacritty -n "__fish_use_subcommand" -s V -l version -d 'Print version' complete -c alacritty -n "__fish_use_subcommand" -f -a "msg" -d 'Send a message to the Alacritty socket' +complete -c alacritty -n "__fish_use_subcommand" -f -a "migrate" -d 'Migrate the configuration file' complete -c alacritty -n "__fish_use_subcommand" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' complete -c alacritty -n "__fish_seen_subcommand_from msg; and not __fish_seen_subcommand_from create-window; and not __fish_seen_subcommand_from config; and not __fish_seen_subcommand_from help" -s s -l socket -d 'IPC socket connection path override' -r -F complete -c alacritty -n "__fish_seen_subcommand_from msg; and not __fish_seen_subcommand_from create-window; and not __fish_seen_subcommand_from config; and not __fish_seen_subcommand_from help" -s h -l help -d 'Print help' @@ -32,7 +33,14 @@ complete -c alacritty -n "__fish_seen_subcommand_from msg; and __fish_seen_subco complete -c alacritty -n "__fish_seen_subcommand_from msg; and __fish_seen_subcommand_from help; and not __fish_seen_subcommand_from create-window; and not __fish_seen_subcommand_from config; and not __fish_seen_subcommand_from help" -f -a "create-window" -d 'Create a new window in the same Alacritty process' complete -c alacritty -n "__fish_seen_subcommand_from msg; and __fish_seen_subcommand_from help; and not __fish_seen_subcommand_from create-window; and not __fish_seen_subcommand_from config; and not __fish_seen_subcommand_from help" -f -a "config" -d 'Update the Alacritty configuration' complete -c alacritty -n "__fish_seen_subcommand_from msg; and __fish_seen_subcommand_from help; and not __fish_seen_subcommand_from create-window; and not __fish_seen_subcommand_from config; and not __fish_seen_subcommand_from help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' -complete -c alacritty -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from msg; and not __fish_seen_subcommand_from help" -f -a "msg" -d 'Send a message to the Alacritty socket' -complete -c alacritty -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from msg; and not __fish_seen_subcommand_from help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' +complete -c alacritty -n "__fish_seen_subcommand_from migrate" -s c -l config-file -d 'Path to the configuration file' -r -F +complete -c alacritty -n "__fish_seen_subcommand_from migrate" -s d -l dry-run -d 'Only output TOML config to stdout' +complete -c alacritty -n "__fish_seen_subcommand_from migrate" -s i -l skip-imports -d 'Do not recurse over imports' +complete -c alacritty -n "__fish_seen_subcommand_from migrate" -l skip-renames -d 'Do not move renamed fields to their new location' +complete -c alacritty -n "__fish_seen_subcommand_from migrate" -s s -l silent -d 'Do not output to STDOUT' +complete -c alacritty -n "__fish_seen_subcommand_from migrate" -s h -l help -d 'Print help' +complete -c alacritty -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from msg; and not __fish_seen_subcommand_from migrate; and not __fish_seen_subcommand_from help" -f -a "msg" -d 'Send a message to the Alacritty socket' +complete -c alacritty -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from msg; and not __fish_seen_subcommand_from migrate; and not __fish_seen_subcommand_from help" -f -a "migrate" -d 'Migrate the configuration file' +complete -c alacritty -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from msg; and not __fish_seen_subcommand_from migrate; and not __fish_seen_subcommand_from help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' complete -c alacritty -n "__fish_seen_subcommand_from help; and __fish_seen_subcommand_from msg; and not __fish_seen_subcommand_from create-window; and not __fish_seen_subcommand_from config" -f -a "create-window" -d 'Create a new window in the same Alacritty process' complete -c alacritty -n "__fish_seen_subcommand_from help; and __fish_seen_subcommand_from msg; and not __fish_seen_subcommand_from create-window; and not __fish_seen_subcommand_from config" -f -a "config" -d 'Update the Alacritty configuration' |