File tree 3 files changed +29
-2
lines changed
3 files changed +29
-2
lines changed Original file line number Diff line number Diff line change @@ -124,14 +124,15 @@ func NewDefaultCompleter(opts ...Option) readline.AutoCompleter {
124
124
`\?` ,
125
125
`\a` ,
126
126
`\begin` ,
127
+ `\bind` ,
127
128
`\c` ,
128
- `\connect` ,
129
129
`\C` ,
130
130
`\cd` ,
131
131
`\commit` ,
132
+ `\connect` ,
132
133
`\conninfo` ,
133
- `\copyright` ,
134
134
`\copy` ,
135
+ `\copyright` ,
135
136
`\d+` ,
136
137
`\da+` ,
137
138
`\da` ,
@@ -172,6 +173,7 @@ func NewDefaultCompleter(opts ...Option) readline.AutoCompleter {
172
173
`\echo` ,
173
174
`\f` ,
174
175
`\g` ,
176
+ `\getenv` ,
175
177
`\gexec` ,
176
178
`\gset` ,
177
179
`\gx` ,
Original file line number Diff line number Diff line change @@ -420,6 +420,29 @@ func init() {
420
420
return os .Setenv (n , v )
421
421
},
422
422
},
423
+ GetEnv : {
424
+ Section : SectionOperatingSystem ,
425
+ Name : "getenv" ,
426
+ Desc : Desc {"fetch environment variable" , "VARNAME ENVVAR" },
427
+ Process : func (p * Params ) error {
428
+ n , err := p .Get (true )
429
+ switch {
430
+ case err != nil :
431
+ return err
432
+ case n == "" :
433
+ return text .ErrMissingRequiredArgument
434
+ }
435
+ v , err := p .Get (true )
436
+ switch {
437
+ case err != nil :
438
+ return err
439
+ case v == "" :
440
+ return text .ErrMissingRequiredArgument
441
+ }
442
+ value , _ := env .Getenv (v )
443
+ return env .Set (n , value )
444
+ },
445
+ },
423
446
Timing : {
424
447
Section : SectionOperatingSystem ,
425
448
Name : "timing" ,
Original file line number Diff line number Diff line change @@ -68,6 +68,8 @@ const (
68
68
ChangeDir
69
69
// SetEnv is the system set environment variable meta command (\setenv).
70
70
SetEnv
71
+ // GetEnv is the system get environment variable meta command (\getenv).
72
+ GetEnv
71
73
// Shell is the system shell exec meta command (\!).
72
74
Shell
73
75
// Out is the switch output meta command (\o).
You can’t perform that action at this time.
0 commit comments