feat: rename `-x` short flag to `-e`

pull/13847/head
Nik Revenco 2025-07-02 15:01:04 +01:00
parent 84494f1035
commit eb486a915f
7 changed files with 7 additions and 6 deletions

View File

@ -21,7 +21,7 @@ _hx() {
case "$2" in case "$2" in
-*) -*)
mapfile -t COMPREPLY < <(compgen -W "-h --help --tutor -V --version -v -vv -vvv --health -g --grammar --vsplit --hsplit -x --execute -c --config --log" -- """$2""") mapfile -t COMPREPLY < <(compgen -W "-h --help --tutor -V --version -v -vv -vvv --health -g --grammar --vsplit --hsplit -e --execute -c --config --log" -- """$2""")
return 0 return 0
;; ;;
*) *)

View File

@ -50,7 +50,7 @@ set edit:completion:arg-completer[hx] = {|@args|
$candidate "--grammar" "(Fetch or build the tree-sitter grammars)" $candidate "--grammar" "(Fetch or build the tree-sitter grammars)"
$candidate "--vsplit" "(Splits all given files vertically)" $candidate "--vsplit" "(Splits all given files vertically)"
$candidate "--hsplit" "(Splits all given files horizontally)" $candidate "--hsplit" "(Splits all given files horizontally)"
$candidate "-x" "(Executes the given command on startup)" $candidate "-e" "(Executes the given command on startup)"
$candidate "--execute" "(Executes the given command on startup)" $candidate "--execute" "(Executes the given command on startup)"
$candidate "--config" "(Specifies a file to use for configuration)" $candidate "--config" "(Specifies a file to use for configuration)"
$candidate "--log" "(Specifies a file to write log data into)" $candidate "--log" "(Specifies a file to write log data into)"

View File

@ -12,6 +12,7 @@ complete -c hx -l hsplit -d "Splits all given files horizontally"
complete -c hx -s c -l config -r -d "Specifies a file to use for config" complete -c hx -s c -l config -r -d "Specifies a file to use for config"
complete -c hx -l log -r -d "Specifies a file to use for logging" complete -c hx -l log -r -d "Specifies a file to use for logging"
complete -c hx -s w -l working-dir -d "Specify initial working directory" -xa "(__fish_complete_directories)" complete -c hx -s w -l working-dir -d "Specify initial working directory" -xa "(__fish_complete_directories)"
complete -c hx -s e -l execute -d "Executes the given command on startup"
function __hx_langs_ops function __hx_langs_ops
hx --health languages | tail -n '+2' | string replace -fr '^(\S+) .*' '$1' hx --health languages | tail -n '+2' | string replace -fr '^(\S+) .*' '$1'

View File

@ -24,7 +24,7 @@ export extern hx [
--version(-V), # Prints version information --version(-V), # Prints version information
--vsplit, # Splits all given files vertically into different windows --vsplit, # Splits all given files vertically into different windows
--hsplit, # Splits all given files horizontally into different windows --hsplit, # Splits all given files horizontally into different windows
--execute(-x), # Executes the given command on startup --execute(-e), # Executes the given command on startup
--working-dir(-w): glob, # Specify an initial working directory --working-dir(-w): glob, # Specify an initial working directory
...files: glob, # Sets the input file to use, position can also be specified via file[:row[:col]] ...files: glob, # Sets the input file to use, position can also be specified via file[:row[:col]]
] ]

View File

@ -18,7 +18,7 @@ _hx() {
"--hsplit[Splits all given files horizontally]" \ "--hsplit[Splits all given files horizontally]" \
"-c[Specifies a file to use for configuration]" \ "-c[Specifies a file to use for configuration]" \
"--config[Specifies a file to use for configuration]" \ "--config[Specifies a file to use for configuration]" \
"-x[Executes the given command on startup]" \ "-e[Executes the given command on startup]" \
"--execute[Executes the given command on startup]" \ "--execute[Executes the given command on startup]" \
"-w[Specify initial working directory]" \ "-w[Specify initial working directory]" \
"--working-dir[Specify initial working directory]" \ "--working-dir[Specify initial working directory]" \

View File

@ -76,7 +76,7 @@ impl Args {
Some(path) => args.log_file = Some(path.into()), Some(path) => args.log_file = Some(path.into()),
None => anyhow::bail!("--log must specify a path to write"), None => anyhow::bail!("--log must specify a path to write"),
}, },
"-x" | "--execute" => { "-e" | "--execute" => {
if let Some(command) = argv.next().as_deref() { if let Some(command) = argv.next().as_deref() {
args.execute = helix_view::input::parse_macro(command)?; args.execute = helix_view::input::parse_macro(command)?;
} else { } else {

View File

@ -76,7 +76,7 @@ FLAGS:
--hsplit Splits all given files horizontally into different windows --hsplit Splits all given files horizontally into different windows
-w, --working-dir <path> Specify an initial working directory -w, --working-dir <path> Specify an initial working directory
+N Open the first given file at line number N +N Open the first given file at line number N
-x, --execute <command> Executes the given command on startup -e, --execute <command> Executes the given command on startup
", ",
env!("CARGO_PKG_NAME"), env!("CARGO_PKG_NAME"),
VERSION_AND_GIT_HASH, VERSION_AND_GIT_HASH,