main: only check for CLI actions on non-lib builds

This commit is contained in:
Mitchell Hashimoto
2023-09-15 17:14:12 -07:00
parent 1327028d44
commit 23054dc393

View File

@ -201,12 +201,15 @@ pub const GlobalState = struct {
}; };
// We first try to parse any action that we may be executing. // We first try to parse any action that we may be executing.
// We do not execute this in the lib because os.argv is not set.
if (comptime build_config.artifact != .lib) {
self.action = try cli_action.Action.detectCLI(self.alloc); self.action = try cli_action.Action.detectCLI(self.alloc);
// If we have an action executing, we disable logging by default // If we have an action executing, we disable logging by default
// since we write to stderr we don't want logs messing up our // since we write to stderr we don't want logs messing up our
// output. // output.
if (self.action != null) self.logging = .{ .disabled = {} }; if (self.action != null) self.logging = .{ .disabled = {} };
}
// I don't love the env var name but I don't have it in my heart // I don't love the env var name but I don't have it in my heart
// to parse CLI args 3 times (once for actions, once for config, // to parse CLI args 3 times (once for actions, once for config,