add option to execute command on server initialization (#135)
This commit is contained in:
parent
79b05dc365
commit
0fc14e3b2d
8
app.go
8
app.go
@ -136,6 +136,14 @@ func (app *app) loop() {
|
|||||||
clientChan := app.ui.readExpr()
|
clientChan := app.ui.readExpr()
|
||||||
serverChan := readExpr()
|
serverChan := readExpr()
|
||||||
|
|
||||||
|
if gCommand != "" {
|
||||||
|
p := newParser(strings.NewReader(gCommand))
|
||||||
|
if e := p.parseExpr(); e != nil {
|
||||||
|
log.Printf("evaluating start command: %s", e.String())
|
||||||
|
e.eval(app, nil)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-app.quitChan:
|
case <-app.quitChan:
|
||||||
|
6
main.go
6
main.go
@ -21,6 +21,7 @@ var (
|
|||||||
gHostname string
|
gHostname string
|
||||||
gLastDirPath string
|
gLastDirPath string
|
||||||
gSelectionPath string
|
gSelectionPath string
|
||||||
|
gCommand string
|
||||||
gSocketProt string
|
gSocketProt string
|
||||||
gSocketPath string
|
gSocketPath string
|
||||||
gLogPath string
|
gLogPath string
|
||||||
@ -103,6 +104,11 @@ 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(&gCommand,
|
||||||
|
"command",
|
||||||
|
"",
|
||||||
|
"command to execute on client initialization")
|
||||||
|
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
gSocketProt = gDefaultSocketProt
|
gSocketProt = gDefaultSocketProt
|
||||||
|
Loading…
Reference in New Issue
Block a user