This commit is contained in:
Gokcehan committed 2021-04-13 23:29:26 +03:00
1 parent fec767d11b
commit c8f60623f3
11 files changed
+30 -21

No files matched your search

+4 -4
View File
@@ -174,11 +174,11 @@ func (app *app) loop() {
}() }()
} }
if gCustomConfig != "" { if gConfigPath != "" {
if _, err := os.Stat(gCustomConfig); !os.IsNotExist(err) { if _, err := os.Stat(gConfigPath); !os.IsNotExist(err) {
app.readFile(gCustomConfig) app.readFile(gConfigPath)
} else { } else {
log.Printf("Config file does not exist: %s", err) log.Printf("config file does not exist: %s", err)
} }
} else { } else {
for _, path := range gConfigPaths { for _, path := range gConfigPaths {
+2 -3
View File
@@ -6,9 +6,8 @@ lf is a terminal file manager.
Source code can be found in the repository at https://github.com/gokcehan/lf. Source code can be found in the repository at https://github.com/gokcehan/lf.
This documentation can either be read from terminal using 'lf -doc' or online This documentation can either be read from terminal using 'lf -doc' or online at https://godoc.org/github.com/gokcehan/lf.
at https://godoc.org/github.com/gokcehan/lf. You can also use 'doc' command You can also use 'doc' command (default '<f-1>') inside lf to view the documentation in a pager.
(default '<f-1>') inside lf to view the documentation in a pager.
You can run 'lf -help' to see descriptions of command line options. You can run 'lf -help' to see descriptions of command line options.
+1
View File
@@ -9,6 +9,7 @@
_lf () { _lf () {
local -a opts=( local -a opts=(
-command -command
-config
-cpuprofile -cpuprofile
-doc -doc
-last-dir-path -last-dir-path
+1 -1
View File
@@ -9,7 +9,7 @@
# endif # endif
# #
set LF_ARGS = "-command -cpuprofile -doc -last-dir-path -memprofile -remote -selection-path -server -version -help " set LF_ARGS = "-command -config -cpuprofile -doc -last-dir-path -memprofile -remote -selection-path -server -version -help "
complete lf "C/-*/(${LF_ARGS})/" complete lf "C/-*/(${LF_ARGS})/"
complete lfcd "C/-*/(${LF_ARGS})/" complete lfcd "C/-*/(${LF_ARGS})/"
+1
View File
@@ -7,6 +7,7 @@
# #
complete -c lf -o command -r -d 'command to execute on client initialization' complete -c lf -o command -r -d 'command to execute on client initialization'
complete -c lf -o config -r -d 'path to the config file (instead of the usual paths)'
complete -c lf -o cpuprofile -r -d 'path to the file to write the CPU profile' complete -c lf -o cpuprofile -r -d 'path to the file to write the CPU profile'
complete -c lf -o doc -d 'show documentation' complete -c lf -o doc -d 'show documentation'
complete -c lf -o last-dir-path -r -d 'path to the file to write the last dir on exit (to use for cd)' complete -c lf -o last-dir-path -r -d 'path to the file to write the last dir on exit (to use for cd)'
+2
View File
@@ -10,6 +10,7 @@ Register-ArgumentCompleter -Native -CommandName 'lf' -ScriptBlock {
param($wordToComplete) param($wordToComplete)
$completions = @( $completions = @(
[CompletionResult]::new('-command ', '-command', [CompletionResultType]::ParameterName, 'command to execute on client initialization') [CompletionResult]::new('-command ', '-command', [CompletionResultType]::ParameterName, 'command to execute on client initialization')
[CompletionResult]::new('-config ', '-config', [CompletionResultType]::ParameterName, 'path to the config file (instead of the usual paths)')
[CompletionResult]::new('-cpuprofile ', '-cpuprofile', [CompletionResultType]::ParameterName, 'path to the file to write the CPU profile') [CompletionResult]::new('-cpuprofile ', '-cpuprofile', [CompletionResultType]::ParameterName, 'path to the file to write the CPU profile')
[CompletionResult]::new('-doc', '-doc', [CompletionResultType]::ParameterName, 'show documentation') [CompletionResult]::new('-doc', '-doc', [CompletionResultType]::ParameterName, 'show documentation')
[CompletionResult]::new('-last-dir-path ', '-last-dir-path', [CompletionResultType]::ParameterName, 'path to the file to write the last dir on exit (to use for cd)') [CompletionResult]::new('-last-dir-path ', '-last-dir-path', [CompletionResultType]::ParameterName, 'path to the file to write the last dir on exit (to use for cd)')
@@ -18,6 +19,7 @@ Register-ArgumentCompleter -Native -CommandName 'lf' -ScriptBlock {
[CompletionResult]::new('-selection-path ', '-selection-path', [CompletionResultType]::ParameterName, 'path to the file to write selected files on open (to use as open file dialog)') [CompletionResult]::new('-selection-path ', '-selection-path', [CompletionResultType]::ParameterName, 'path to the file to write selected files on open (to use as open file dialog)')
[CompletionResult]::new('-server', '-server', [CompletionResultType]::ParameterName, 'start server (automatic)') [CompletionResult]::new('-server', '-server', [CompletionResultType]::ParameterName, 'start server (automatic)')
[CompletionResult]::new('-version', '-version', [CompletionResultType]::ParameterName, 'show version') [CompletionResult]::new('-version', '-version', [CompletionResultType]::ParameterName, 'show version')
[CompletionResult]::new('-help', '-help', [CompletionResultType]::ParameterName, 'show help')
) )
if ($wordToComplete.StartsWith('-')) { if ($wordToComplete.StartsWith('-')) {
+2
View File
@@ -14,6 +14,7 @@ local arguments
arguments=( arguments=(
'-command[command to execute on client initialization]' '-command[command to execute on client initialization]'
'-config[path to the config file (instead of the usual paths)]'
'-cpuprofile[path to the file to write the CPU profile]' '-cpuprofile[path to the file to write the CPU profile]'
'-doc[show documentation]' '-doc[show documentation]'
'-last-dir-path[path to the file to write the last dir on exit (to use for cd)]' '-last-dir-path[path to the file to write the last dir on exit (to use for cd)]'
@@ -22,6 +23,7 @@ arguments=(
'-selection-path[path to the file to write selected files on open (to use as open file dialog)]' '-selection-path[path to the file to write selected files on open (to use as open file dialog)]'
'-server[start server (automatic)]' '-server[start server (automatic)]'
'-version[show version]' '-version[show version]'
'-help[show help]'
'*:filename:_files' '*:filename:_files'
) )
+5 -5
View File
@@ -4,11 +4,11 @@
# #
# You may also like to assign a key to this command: # You may also like to assign a key to this command:
# #
# Set-PSReadLineKeyHandler -Chord Ctrl+o -ScriptBlock { # Set-PSReadLineKeyHandler -Chord Ctrl+o -ScriptBlock {
# [Microsoft.PowerShell.PSConsoleReadLine]::RevertLine() # [Microsoft.PowerShell.PSConsoleReadLine]::RevertLine()
# [Microsoft.PowerShell.PSConsoleReadLine]::Insert('lfcd.ps1') # [Microsoft.PowerShell.PSConsoleReadLine]::Insert('lfcd.ps1')
# [Microsoft.PowerShell.PSConsoleReadLine]::AcceptLine() # [Microsoft.PowerShell.PSConsoleReadLine]::AcceptLine()
# } # }
# #
# You may put this in one of the profiles found in $PROFILE. # You may put this in one of the profiles found in $PROFILE.
# #
+2
View File
@@ -24,6 +24,7 @@ lf \- terminal file manager
.SH SYNOPSIS .SH SYNOPSIS
.SY lf .SY lf
.OP \-command command .OP \-command command
.OP \-config path
.OP \-cpuprofile path .OP \-cpuprofile path
.OP \-doc .OP \-doc
.OP \-last-dir-path path .OP \-last-dir-path path
@@ -32,6 +33,7 @@ lf \- terminal file manager
.OP \-selection-path path .OP \-selection-path path
.OP \-server .OP \-server
.OP \-version .OP \-version
.OP \-help
.RI [ directory ] .RI [ directory ]
.YS .YS
.SH DESCRIPTION .SH DESCRIPTION
+2
View File
@@ -5,6 +5,7 @@ lf \- terminal file manager
.SH SYNOPSIS .SH SYNOPSIS
.SY lf .SY lf
.OP \-command command .OP \-command command
.OP \-config path
.OP \-cpuprofile path .OP \-cpuprofile path
.OP \-doc .OP \-doc
.OP \-last-dir-path path .OP \-last-dir-path path
@@ -13,6 +14,7 @@ lf \- terminal file manager
.OP \-selection-path path .OP \-selection-path path
.OP \-server .OP \-server
.OP \-version .OP \-version
.OP \-help
.RI [ directory ] .RI [ directory ]
.YS .YS
.SH DESCRIPTION .SH DESCRIPTION
+8 -8
View File
@@ -31,7 +31,7 @@ var (
gLogPath string gLogPath string
gServerLogPath string gServerLogPath string
gSelect string gSelect string
gCustomConfig string gConfigPath string
gCommands arrayFlag gCommands arrayFlag
gVersion string gVersion string
) )
@@ -188,16 +188,16 @@ func main() {
false, false,
"show version") "show version")
remoteCmd := flag.String(
"remote",
"",
"send remote command to server")
serverMode := flag.Bool( serverMode := flag.Bool(
"server", "server",
false, false,
"start server (automatic)") "start server (automatic)")
remoteCmd := flag.String(
"remote",
"",
"send remote command to server")
cpuprofile := flag.String( cpuprofile := flag.String(
"cpuprofile", "cpuprofile",
"", "",
@@ -218,10 +218,10 @@ func main() {
"", "",
"path to the file to write selected files on open (to use as open file dialog)") "path to the file to write selected files on open (to use as open file dialog)")
flag.StringVar(&gCustomConfig, flag.StringVar(&gConfigPath,
"config", "config",
"", "",
"path to a custom config file to be used, instead of normal lfrc file") "path to the config file (instead of the usual paths)")
flag.Var(&gCommands, flag.Var(&gCommands,
"command", "command",