10 Commits

Author SHA1 Message Date
Michael Stapelberg 6994f9152c instanceflag: support absolute and relative instance name (-i)
Also detect whether the current directory contains a gokrazy instance
by checking for a well-formed config.json instead of comparing
against the parent directory (--parent_dir).

This commit makes the parent directory less relevant.
2026-06-25 08:56:34 +02:00
Michael Stapelberg 691b1044c1 instanceflag: remove all global state, incl. implicit filepath.Abs() 2026-06-23 08:42:15 +02:00
Michael Stapelberg 0c8897a4a8 instanceflag: add InstancePath() and InstanceConfigPath() accessors
These are copied over from the config package,
but without referencing any global state (only Flags).
2026-06-22 08:38:19 +02:00
Michael Stapelberg 8b3a7add0c instanceflag: store instance / parentDir in Flags and return it
This is one step towards getting rid of global state.
2026-06-21 21:03:29 +02:00
Michael Stapelberg 5f469e7488 instanceflag: make ParentDir() absolute
related to https://github.com/gokrazy/tools/issues/50
2023-03-13 08:49:23 +01:00
Michael Stapelberg 9608422911 initialize instance flag to $PWD if inside an instance dir
(for convenience)
2023-02-11 18:14:10 +01:00
Michael Stapelberg 063b533a8f instanceflag: initialize even when not registered on pflags
This fixes using instanceflag from breakglass (which is not on pflags).
2023-01-15 13:35:31 +01:00
Michael Stapelberg d172888a87 instanceflag: make overrideable 2023-01-15 13:35:25 +01:00
Michael Stapelberg f7440a1551 implement support for instance configuration
related to https://github.com/gokrazy/gokrazy/issues/147
2023-01-07 15:39:36 +01:00
Michael Stapelberg 6c14a9bfe6 add instanceflag package
related to https://github.com/gokrazy/gokrazy/issues/147
2023-01-07 15:39:30 +01:00