File tree 6 files changed +17
-2
lines changed
6 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ _hx() {
16
16
COMPREPLY=($( compgen -W " $languages " -- $2 ) )
17
17
;;
18
18
* )
19
- COMPREPLY=($( compgen -fd -W " -h --help --tutor -V --version -v -vv -vvv --health -g --grammar --vsplit --hsplit -c --config" -- $2 ) )
19
+ COMPREPLY=($( compgen -fd -W " -h --help --tutor -V --version -v -vv -vvv --health -g --grammar --vsplit --hsplit -c --config --log " -- $2 ) )
20
20
;;
21
21
esac
22
22
} && complete -F _hx hx
Original file line number Diff line number Diff line change @@ -36,6 +36,11 @@ set edit:completion:arg-completer[hx] = {|@args|
36
36
edit:complete-filename $args [ -1] | each { | v| put $v [ stem] }
37
37
return
38
38
}
39
+ # When we have --log, we need a file
40
+ if ( has-values "log" $args [ -2]) {
41
+ edit:complete-filename $args [ -1] | each { | v| put $v [ stem] }
42
+ return
43
+ }
39
44
}
40
45
edit:complete-filename $args [ -1] | each { | v| put $v [ stem]}
41
46
$candidate "--help" "(Prints help information)"
@@ -46,4 +51,5 @@ set edit:completion:arg-completer[hx] = {|@args|
46
51
$candidate "--vsplit" "(Splits all given files vertically)"
47
52
$candidate "--hsplit" "(Splits all given files horizontally)"
48
53
$candidate "--config" "(Specifies a file to use for configuration)"
49
- }
54
+ $candidate "--log" "(Specifies a file to write log data into)"
55
+ }
Original file line number Diff line number Diff line change @@ -12,3 +12,4 @@ complete -c hx -s V -l version -d "Prints version information"
12
12
complete -c hx -l vsplit -d " Splits all given files vertically into different windows"
13
13
complete -c hx -l hsplit -d " Splits all given files horizontally into different windows"
14
14
complete -c hx -s c -l config -d " Specifies a file to use for completion"
15
+ complete -c hx -s c -l log -d " Specifies a file to write log data into"
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ _hx() {
18
18
" --hsplit[Splits all given files horizontally into different windows]" \
19
19
" -c[Specifies a file to use for configuration]" \
20
20
" --config[Specifies a file to use for configuration]" \
21
+ " --log[Specifies a file to write log data into]" \
21
22
" *:file:_files"
22
23
23
24
case " $state " in
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ pub struct Args {
14
14
pub build_grammars : bool ,
15
15
pub split : Option < Layout > ,
16
16
pub verbosity : u64 ,
17
+ pub log_file : Option < PathBuf > ,
17
18
pub config_file : Option < PathBuf > ,
18
19
pub files : Vec < ( PathBuf , Position ) > ,
19
20
}
@@ -48,6 +49,10 @@ impl Args {
48
49
Some ( path) => args. config_file = Some ( path. into ( ) ) ,
49
50
None => anyhow:: bail!( "--config must specify a path to read" ) ,
50
51
} ,
52
+ "--log" => match argv. next ( ) . as_deref ( ) {
53
+ Some ( path) => args. log_file = Some ( path. into ( ) ) ,
54
+ None => anyhow:: bail!( "--log must specify a path to write" ) ,
55
+ } ,
51
56
arg if arg. starts_with ( "--" ) => {
52
57
anyhow:: bail!( "unexpected double dash argument: {}" , arg)
53
58
}
Original file line number Diff line number Diff line change 67
67
-g, --grammar {{fetch|build}} Fetches or builds tree-sitter grammars listed in languages.toml
68
68
-c, --config <file> Specifies a file to use for configuration
69
69
-v Increases logging verbosity each use for up to 3 times
70
+ --log Specifies a file to use for logging
70
71
(default file: {})
71
72
-V, --version Prints version information
72
73
--vsplit Splits all given files vertically into different windows
@@ -114,6 +115,7 @@ FLAGS:
114
115
return Ok ( 0 ) ;
115
116
}
116
117
118
+ let logpath = args. log_file . as_ref ( ) . cloned ( ) . unwrap_or ( logpath) ;
117
119
setup_logging ( logpath, args. verbosity ) . context ( "failed to initialize logging" ) ?;
118
120
119
121
let config_dir = helix_loader:: config_dir ( ) ;
You can’t perform that action at this time.
0 commit comments