add 'autoquit' option to auto quit server on quit

cc #177
This commit is contained in:
Gokcehan committed 2021-05-19 21:55:19 +03:00
1 parent 7bf895e301
commit 06a30eda19
7 files changed
+35 -2

No files matched your search

+7 -2
View File
@@ -59,11 +59,16 @@ func newApp(ui *ui, nav *nav) *app {
}
func (app *app) quit() {
if err := app.writeHistory(); err != nil {
log.Printf("writing history file: %s", err)
}
if err := remote(fmt.Sprintf("drop %d", gClientID)); err != nil {
log.Printf("dropping connection: %s", err)
}
if err := app.writeHistory(); err != nil {
log.Printf("writing history file: %s", err)
if gOpts.autoquit {
if err := remote("quit"); err != nil {
log.Printf("auto quitting server: %s", err)
}
}
os.Remove(gLogPath)
}
+3
View File
@@ -70,6 +70,9 @@ var (
"anchorfind",
"noanchorfind",
"anchorfind!",
"autoquit",
"noautoquit",
"autoquit!",
"dircounts",
"nodircounts",
"dircounts!",
+5
View File
@@ -98,6 +98,7 @@ The following command line commands are provided by lf:
The following options can be used to customize the behavior of lf:
anchorfind bool (default on)
autoquit bool (default off)
dircounts bool (default off)
dirfirst bool (default on)
drawbox bool (default off)
@@ -489,6 +490,10 @@ Character ':' is used as the separator for list options '[]int' and '[]string'.
When this option is enabled, find command starts matching patterns from the beginning of file names, otherwise, it can match at an arbitrary position.
autoquit bool (default off)
Automatically quit server when there are no clients left connected.
dircounts bool (default off)
When this option is enabled, directory sizes show the number of items inside instead of the size of directory file.
+5
View File
@@ -102,6 +102,7 @@ The following command line commands are provided by lf:
The following options can be used to customize the behavior of lf:
anchorfind bool (default on)
autoquit bool (default off)
dircounts bool (default off)
dirfirst bool (default on)
drawbox bool (default off)
@@ -515,6 +516,10 @@ Character ':' is used as the separator for list options '[]int' and
When this option is enabled, find command starts matching patterns from the
beginning of file names, otherwise, it can match at an arbitrary position.
autoquit bool (default off)
Automatically quit server when there are no clients left connected.
dircounts bool (default off)
When this option is enabled, directory sizes show the number of items inside
+6
View File
@@ -20,6 +20,12 @@ func (e *setExpr) eval(app *app, args []string) {
gOpts.anchorfind = false
case "anchorfind!":
gOpts.anchorfind = !gOpts.anchorfind
case "autoquit":
gOpts.autoquit = true
case "noautoquit":
gOpts.autoquit = false
case "autoquit!":
gOpts.autoquit = !gOpts.autoquit
case "dircounts":
gOpts.dircounts = true
case "nodircounts":
+7
View File
@@ -116,6 +116,7 @@ The following options can be used to customize the behavior of lf:
.PP
.EX
anchorfind bool (default on)
autoquit bool (default off)
dircounts bool (default off)
dirfirst bool (default on)
drawbox bool (default off)
@@ -609,6 +610,12 @@ This section shows information about options to customize the behavior. Characte
.PP
When this option is enabled, find command starts matching patterns from the beginning of file names, otherwise, it can match at an arbitrary position.
.PP
.EX
autoquit bool (default off)
.EE
.PP
Automatically quit server when there are no clients left connected.
.PP
.EX
dircounts bool (default off)
.EE
+2
View File
@@ -29,6 +29,7 @@ type sortType struct {
var gOpts struct {
anchorfind bool
autoquit bool
dircounts bool
drawbox bool
globsearch bool
@@ -71,6 +72,7 @@ var gOpts struct {
func init() {
gOpts.anchorfind = true
gOpts.autoquit = false
gOpts.dircounts = false
gOpts.drawbox = false
gOpts.globsearch = false