From: Cheng-Ling Lai Date: Fri, 12 Dec 2025 01:16:22 +0000 (+0800) Subject: Moved wrap_shell_args to anonymous namespace X-Git-Tag: v0.13.1~62^2~5 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8ea51b74400c920a03ad6469a31eb00b0fac63fd;p=thirdparty%2Fsnapper.git Moved wrap_shell_args to anonymous namespace --- diff --git a/client/snbk/Shell.cc b/client/snbk/Shell.cc index 319eb059..9cf38784 100644 --- a/client/snbk/Shell.cc +++ b/client/snbk/Shell.cc @@ -56,6 +56,24 @@ namespace snapper return quote(args.get_values()); } + + string wrap_shell_args(const Shell& shell, const SystemCmd::Args& args) + { + string tmp = quote(args); + switch (shell.mode) + { + case Shell::Mode::DIRECT: + return tmp; + + case Shell::Mode::SSH: + return SSH_BIN " " + quote(shell.ssh_options) + " " + + SystemCmd::quote(tmp); + } + + SN_THROW(Exception("invalid shell mode")); + __builtin_unreachable(); + } + } @@ -81,28 +99,12 @@ namespace snapper __builtin_unreachable(); } - string _wrap_shell_args(const Shell& shell, const SystemCmd::Args& args) - { - string tmp = quote(args); - switch (shell.mode) - { - case Shell::Mode::DIRECT: - return tmp; - - case Shell::Mode::SSH: - return SSH_BIN " " + quote(shell.ssh_options) + " " + quote(tmp); - } - - SN_THROW(Exception("invalid shell mode")); - __builtin_unreachable(); - } - SystemCmd::Args shellify_pipe(const Shell& shell1, const SystemCmd::Args& args1, const Shell& shell2, const SystemCmd::Args& args2) { - return { SH_BIN, "-c", _wrap_shell_args(shell1, args1) + " | " + - _wrap_shell_args(shell2, args2) }; + return { SH_BIN, "-c", wrap_shell_args(shell1, args1) + " | " + + wrap_shell_args(shell2, args2) }; } }