fortify: move flag handling to separate files
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
This commit is contained in:
parent
8d82446d97
commit
d2575b6708
|
@ -7,7 +7,6 @@ import (
|
|||
)
|
||||
|
||||
var (
|
||||
userName string
|
||||
confPath string
|
||||
|
||||
dbusConfigSession string
|
||||
|
@ -16,19 +15,17 @@ var (
|
|||
dbusID string
|
||||
mpris bool
|
||||
|
||||
userName string
|
||||
mustWayland bool
|
||||
mustX bool
|
||||
mustDBus bool
|
||||
mustPulse bool
|
||||
|
||||
flagVerbose bool
|
||||
printVersion bool
|
||||
|
||||
launchMethodText string
|
||||
)
|
||||
|
||||
func init() {
|
||||
flag.StringVar(&userName, "u", "chronos", "Passwd name of user to run as")
|
||||
// config file, disables every other flag here
|
||||
flag.StringVar(&confPath, "c", "nil", "Path to full app configuration, or \"nil\" to configure from flags")
|
||||
|
||||
flag.StringVar(&dbusConfigSession, "dbus-config", "builtin", "Path to D-Bus proxy config file, or \"builtin\" for defaults")
|
||||
|
@ -37,13 +34,11 @@ func init() {
|
|||
flag.StringVar(&dbusID, "dbus-id", "", "D-Bus ID of application, leave empty to disable own paths, has no effect if custom config is available")
|
||||
flag.BoolVar(&mpris, "mpris", false, "Allow owning MPRIS D-Bus path, has no effect if custom config is available")
|
||||
|
||||
flag.StringVar(&userName, "u", "chronos", "Passwd name of user to run as")
|
||||
flag.BoolVar(&mustWayland, "wayland", false, "Share Wayland socket")
|
||||
flag.BoolVar(&mustX, "X", false, "Share X11 socket and allow connection")
|
||||
flag.BoolVar(&mustDBus, "dbus", false, "Proxy D-Bus connection")
|
||||
flag.BoolVar(&mustPulse, "pulse", false, "Share PulseAudio socket and cookie")
|
||||
|
||||
flag.BoolVar(&flagVerbose, "v", false, "Verbose output")
|
||||
flag.BoolVar(&printVersion, "V", false, "Print version")
|
||||
}
|
||||
|
||||
func init() {
|
9
main.go
9
main.go
|
@ -16,14 +16,11 @@ import (
|
|||
)
|
||||
|
||||
var (
|
||||
Version = "impure"
|
||||
flagVerbose bool
|
||||
)
|
||||
|
||||
func tryVersion() {
|
||||
if printVersion {
|
||||
fmt.Println(Version)
|
||||
os.Exit(0)
|
||||
}
|
||||
func init() {
|
||||
flag.BoolVar(&flagVerbose, "v", false, "Verbose output")
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
)
|
||||
|
||||
var (
|
||||
Version = "impure"
|
||||
|
||||
printVersion bool
|
||||
)
|
||||
|
||||
func init() {
|
||||
flag.BoolVar(&printVersion, "V", false, "Print version")
|
||||
}
|
||||
|
||||
func tryVersion() {
|
||||
if printVersion {
|
||||
fmt.Println(Version)
|
||||
os.Exit(0)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue