Finally functional
This commit is contained in:
parent
be8936a665
commit
b673c640e4
12 changed files with 261 additions and 113 deletions
16
args/args.go
16
args/args.go
|
@ -5,7 +5,6 @@ package args
|
|||
|
||||
import (
|
||||
"flag"
|
||||
"os"
|
||||
)
|
||||
|
||||
/* Method to trigger flag parsing. Can be called multiple times safely. */
|
||||
|
@ -13,11 +12,6 @@ func Parse() {
|
|||
if (flagsParsed) {return}
|
||||
flag.Parse();
|
||||
flagsParsed = true;
|
||||
|
||||
// Process DBUS socket location
|
||||
if socketLocation == nil || *socketLocation == "" {
|
||||
*socketLocation = os.Getenv("DBUS_SYSTEM_BUS_ADDRESS");
|
||||
}
|
||||
}
|
||||
/* module-specific variable to avoid re-parsing flags */
|
||||
var flagsParsed bool = false;
|
||||
|
@ -38,18 +32,10 @@ func GetHTTPPort() (port int, set bool) {
|
|||
return *httpPort, true;
|
||||
}
|
||||
|
||||
/* Listen on a UNIX socket */
|
||||
var socketLocation = flag.String("socket", "", "Location of UNIX socket to listen on. Setting will disable TCP.")
|
||||
/* @return set boolean will be true if argument is not nil */
|
||||
func GetSocketLocation() (port string, set bool) {
|
||||
if socketLocation == nil {return "", false}
|
||||
return *socketLocation, true;
|
||||
}
|
||||
|
||||
/* Where the signal-cli binary is */
|
||||
var binaryLocation = flag.String("binary", "/usr/local/bin/signal-cli", "Location of the signal-cli binary.")
|
||||
/* @return set boolean will be true if argument is not nil */
|
||||
func GetBinaryLocation() (port string, set bool) {
|
||||
func GetBinaryLocation() (binary string, set bool) {
|
||||
if binaryLocation == nil {return "", false}
|
||||
return *binaryLocation, true;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue