aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--config.go (renamed from flag.go)11
-rw-r--r--main.go9
-rw-r--r--version.go24
3 files changed, 30 insertions, 14 deletions
diff --git a/flag.go b/config.go
index 673601d5..c5a58979 100644
--- a/flag.go
+++ b/config.go
@@ -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() {
diff --git a/main.go b/main.go
index c30bfcaf..45fbd216 100644
--- a/main.go
+++ b/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() {
diff --git a/version.go b/version.go
new file mode 100644
index 00000000..808a57b9
--- /dev/null
+++ b/version.go
@@ -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)
+ }
+}