Export command line flags as environment variables (#2079)
This commit is contained in:
1 parent
42b36fd52c
commit
02156a3806
4 files changed
+25
-1
No files matched your search
@@ -89,6 +89,16 @@ func exportEnvVars() {
|
||||
os.Setenv("LF_LEVEL", strconv.Itoa(level))
|
||||
}
|
||||
|
||||
func exportFlags() {
|
||||
os.Setenv("lf_flag_config", gConfigPath)
|
||||
os.Setenv("lf_flag_last_dir_path", gLastDirPath)
|
||||
os.Setenv("lf_flag_log", gLogPath)
|
||||
os.Setenv("lf_flag_print_last_dir", strconv.FormatBool(gPrintLastDir))
|
||||
os.Setenv("lf_flag_print_selection", strconv.FormatBool(gPrintSelection))
|
||||
os.Setenv("lf_flag_selection_path", gSelectionPath)
|
||||
os.Setenv("lf_flag_single", strconv.FormatBool(gSingleMode))
|
||||
}
|
||||
|
||||
// used by exportOpts below
|
||||
func fieldToString(field reflect.Value) string {
|
||||
kind := field.Kind()
|
||||
@@ -355,6 +365,7 @@ func main() {
|
||||
}
|
||||
|
||||
exportEnvVars()
|
||||
exportFlags()
|
||||
|
||||
run()
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user