Fix hyphen support in --prefix

This commit is contained in:
Elnu 2025-03-26 12:53:26 -07:00
parent 14a9dde083
commit a1f947eb50
2 changed files with 3 additions and 2 deletions

View file

@ -107,7 +107,7 @@ Some utility commands:
wantedBy = [ "network.target" ];
serviceConfig = {
ExecStart = ''
${cfg.package}/bin/ji-chan --domain ${cfg.domain} --token ${cfg.token} --prefix "${builtins.replaceStrings ["\"" "-"] ["\\\"" "\\-"] cfg.prefix}" --hugo ${cfg.hugo} --guilds ${cfg.guildData}
${cfg.package}/bin/ji-chan --domain ${cfg.domain} --token ${cfg.token} --prefix "${builtins.replaceStrings ["\""] ["\\\""] cfg.prefix}" --hugo ${cfg.hugo} --guilds ${cfg.guildData}
'';
Restart = "always";
DynamicUser = true;

View file

@ -29,10 +29,11 @@ struct Arguments {
#[clap(long = "token", help = "Discord token")]
pub discord_token: String,
#[clap(long, help = "Traditional text command prefix, including space, if any", default_value = "-h")]
#[structopt(allow_hyphen_values = true)] // clap will eat hyphens e.g. "-h" or -h otherwise
pub prefix: String,
#[clap(long, help = "Path to Hugo project where site rebuilds")]
pub hugo: String,
#[clap(long = "guilds", help = "Guild data JSON file", default_value = "guilds.json")]
#[clap(long = "guilds", help = "Path to guild data JSON file", default_value = "guilds.json")]
pub guild_data: String,
}