diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/slskd/Application.cs | 6 | ||||
| -rw-r--r-- | src/slskd/Core/Options.cs | 102 | ||||
| -rw-r--r-- | src/slskd/Program.cs | 4 |
3 files changed, 62 insertions, 50 deletions
diff --git a/src/slskd/Application.cs b/src/slskd/Application.cs index 44723aba..cf37d933 100644 --- a/src/slskd/Application.cs +++ b/src/slskd/Application.cs @@ -362,12 +362,12 @@ namespace slskd Log.Information($"Using Proxy {OptionsAtStartup.Soulseek.Connection.Proxy.Address}:{OptionsAtStartup.Soulseek.Connection.Proxy.Port}"); } - if (!OptionsAtStartup.NoVersionCheck) + if (!OptionsAtStartup.Flags.NoVersionCheck) { _ = CheckVersionAsync(); } - if (OptionsAtStartup.NoShareScan) + if (OptionsAtStartup.Flags.NoShareScan) { Log.Warning("Not scanning shares; 'no-share-scan' option is enabled. Search and browse results will remain disabled until a manual scan is completed."); } @@ -376,7 +376,7 @@ namespace slskd _ = Shares.StartScanAsync(); } - if (OptionsAtStartup.NoConnect) + if (OptionsAtStartup.Flags.NoConnect) { Log.Warning("Not connecting to the Soulseek server; 'no-connect' option is enabled"); } diff --git a/src/slskd/Core/Options.cs b/src/slskd/Core/Options.cs index 197c3412..f2e89aeb 100644 --- a/src/slskd/Core/Options.cs +++ b/src/slskd/Core/Options.cs @@ -136,51 +136,6 @@ namespace slskd public bool Debug { get; init; } = Debugger.IsAttached; /// <summary> - /// Gets a value indicating whether the logo should be suppressed on startup. - /// </summary> - [Argument('n', "no-logo")] - [EnvironmentVariable("NO_LOGO")] - [Description("suppress logo on startup")] - [RequiresRestart] - public bool NoLogo { get; init; } = false; - - /// <summary> - /// Gets a value indicating whether the application should quit after initialization. - /// </summary> - [Argument('x', "no-start")] - [EnvironmentVariable("NO_START")] - [Description("quit the application after initialization")] - [RequiresRestart] - public bool NoStart { get; init; } = false; - - /// <summary> - /// Gets a value indicating whether the application should connect to the Soulseek network on startup. - /// </summary> - [Argument(default, "no-connect")] - [EnvironmentVariable("NO_CONNECT")] - [Description("do not connect to the Soulseek network on startup")] - [RequiresRestart] - public bool NoConnect { get; init; } = false; - - /// <summary> - /// Gets a value indicating whether the application should scan shared directories on startup. - /// </summary> - [Argument(default, "no-share-scan")] - [EnvironmentVariable("NO_SHARE_SCAN")] - [Description("do not scan shares on startup")] - [RequiresRestart] - public bool NoShareScan { get; init; } = false; - - /// <summary> - /// Gets a value indicating whether the application should check for a newer version on startup. - /// </summary> - [Argument(default, "no-version-check")] - [EnvironmentVariable("NO_VERSION_CHECK")] - [Description("do not check for newer version at startup")] - [RequiresRestart] - public bool NoVersionCheck { get; init; } = false; - - /// <summary> /// Gets a value indicating whether remote configuration of options is allowed. /// </summary> [Argument(default, "remote-configuration")] @@ -198,6 +153,12 @@ namespace slskd public string InstanceName { get; init; } = "default"; /// <summary> + /// Gets optional flags. + /// </summary> + [Validate] + public FlagsOptions Flags { get; init; } = new FlagsOptions(); + + /// <summary> /// Gets the path where application data is saved. /// </summary> [Argument(default, "app")] @@ -285,6 +246,57 @@ namespace slskd public IntegrationOptions Integration { get; init; } = new IntegrationOptions(); /// <summary> + /// Optional flags. + /// </summary> + public class FlagsOptions + { + /// <summary> + /// Gets a value indicating whether the logo should be suppressed on startup. + /// </summary> + [Argument('n', "no-logo")] + [EnvironmentVariable("NO_LOGO")] + [Description("suppress logo on startup")] + [RequiresRestart] + public bool NoLogo { get; init; } = false; + + /// <summary> + /// Gets a value indicating whether the application should quit after initialization. + /// </summary> + [Argument('x', "no-start")] + [EnvironmentVariable("NO_START")] + [Description("quit the application after initialization")] + [RequiresRestart] + public bool NoStart { get; init; } = false; + + /// <summary> + /// Gets a value indicating whether the application should connect to the Soulseek network on startup. + /// </summary> + [Argument(default, "no-connect")] + [EnvironmentVariable("NO_CONNECT")] + [Description("do not connect to the Soulseek network on startup")] + [RequiresRestart] + public bool NoConnect { get; init; } = false; + + /// <summary> + /// Gets a value indicating whether the application should scan shared directories on startup. + /// </summary> + [Argument(default, "no-share-scan")] + [EnvironmentVariable("NO_SHARE_SCAN")] + [Description("do not scan shares on startup")] + [RequiresRestart] + public bool NoShareScan { get; init; } = false; + + /// <summary> + /// Gets a value indicating whether the application should check for a newer version on startup. + /// </summary> + [Argument(default, "no-version-check")] + [EnvironmentVariable("NO_VERSION_CHECK")] + [Description("do not check for newer version at startup")] + [RequiresRestart] + public bool NoVersionCheck { get; init; } = false; + } + + /// <summary> /// Directory options. /// </summary> public class DirectoriesOptions : IValidatableObject diff --git a/src/slskd/Program.cs b/src/slskd/Program.cs index 5ed6bf80..e733c086 100644 --- a/src/slskd/Program.cs +++ b/src/slskd/Program.cs @@ -300,7 +300,7 @@ namespace slskd ConfigureGlobalLogger(); Log = Serilog.Log.ForContext(typeof(Program)); - if (!OptionsAtStartup.NoLogo) + if (!OptionsAtStartup.Flags.NoLogo) { PrintLogo(FullVersion); } @@ -385,7 +385,7 @@ namespace slskd app.ConfigureAspDotNetPipeline(); - if (OptionsAtStartup.NoStart) + if (OptionsAtStartup.Flags.NoStart) { Log.Information("Qutting because 'no-start' option is enabled"); return; |
