Add -print-last-dir and -print-selection flags (#1402)

* Add `-print-last-dir` and `-print-selection` flags

* Add shell completions

* Update `lfcd.sh` example to use new flag
This commit is contained in:
Joe Lim authored and GitHub committed 2023-08-31 10:10:31 +10:00
1 parent 63d21b5a3e
commit 6aa3d2aa18
10 files changed
+50 -26

No files matched your search

+26 -12
View File
@@ -22,18 +22,20 @@ var (
type arrayFlag []string
var (
gSingleMode bool
gClientID int
gHostname string
gLastDirPath string
gSelectionPath string
gSocketProt string
gSocketPath string
gLogPath string
gSelect string
gConfigPath string
gCommands arrayFlag
gVersion string
gSingleMode bool
gPrintLastDir bool
gPrintSelection bool
gClientID int
gHostname string
gLastDirPath string
gSelectionPath string
gSocketProt string
gSocketPath string
gLogPath string
gSelect string
gConfigPath string
gCommands arrayFlag
gVersion string
)
func (a *arrayFlag) Set(v string) error {
@@ -228,6 +230,16 @@ func main() {
false,
"start a client without server")
printLastDir := flag.Bool(
"print-last-dir",
false,
"print the last dir to stdout on exit (to use for cd)")
printSelection := flag.Bool(
"print-selection",
false,
"print the selected files to stdout on open (to use as open file dialog)")
remoteCmd := flag.String(
"remote",
"",
@@ -305,6 +317,8 @@ func main() {
serve()
default:
gSingleMode = *singleMode
gPrintLastDir = *printLastDir
gPrintSelection = *printSelection
if !gSingleMode {
checkServer()