fn interpolate_specific_args(
        cmd_str: &str,
        name: &str,
        args: &[String],
        prog_args: &[String],
    ) -> Result<(String, Vec<String>), String> {
        // Check if the correct number of arguments was provided
        // Even if we're inserting the rest later, we still need the mandatory ones
        if args.len() > prog_args.len() {
            return Err(
                format!(
                    "The command '{command}' requires {num_required_args} argument(s), but {num_given_args} argument(s) were provided (too few). Please provide all the required arguments.",
                    command=name,
                    num_required_args=args.len(),
                    num_given_args=&prog_args.len()
                )
            );
        }
        // We don't warn if there are too many and we're not inserting the rest with `%%` later because that would mean checking every potential subcommand for `%%` as well if they exist
        let mut with_args = cmd_str.to_string();
        // We need to know the index so we can correlate to the index of the argument in `args`
        for (idx, arg) in args.iter().enumerate() {
            // The arrays are the same length, see above check
            // All arguments are shown in the command string as `%name` or the like, so we get that whole string
            let given_value = &prog_args[idx];
            let arg_with_sign = "%".to_string() + arg;
            let new_command = with_args.replace(&arg_with_sign, given_value);
            // We don't check if we changed something because that doesn't work for multistage or ordered subcommands
            with_args = new_command;
        }
        // Get the program args after a certain point so they can be inserted with `%%` if necessary
        // We do this by getting the part of slice after the specific arguments
        let (_, remaining_args) = prog_args.split_at(args.len());

        Ok((with_args, remaining_args.to_vec())) // FIXME
    }
// Interpolates specific arguments (doesn't handle `%%`)
// This takes a string to interpolate into and doesn't take `self` so the order is open
// This returns the readied command string and the remaining arguments or an error if an argument couldn't be substituted in
// Errors for when the argument can't be interpolated can be silenced for ordered subcommands (which have a universal argument list for many subcommands)
Interpolates specific arguments (doesn't handle `%%`)
This takes a string to interpolate into and doesn't take `self` so the order is open
This returns the readied command string and the remaining arguments or an error if an argument couldn't be substituted in
Errors for when the argument can't be interpolated can be silenced for ordered subcommands (which have a universal argument list for many subcommands)
Interpolates specific arguments ( doesn ' t handle ` %% ` ) This takes a string to interpolate into and doesn ' t take ` self ` so the order is open This returns the readied command string and the remaining arguments or an error if an argument couldn ' t be substituted in Errors for when the argument can ' t be interpolated can be silenced for ordered subcommands ( which have a universal argument list for many subcommands )
fn interpolate_specific_args(
        cmd_str: &str,
        name: &str,
        args: &[String],
        prog_args: &[String],
    ) -> Result<(String, Vec<String>), String> {
        // Check if the correct number of arguments was provided
        // Even if we're inserting the rest later, we still need the mandatory ones
        if args.len() > prog_args.len() {
            return Err(
                format!(
                    "The command '{command}' requires {num_required_args} argument(s), but {num_given_args} argument(s) were provided (too few). Please provide all the required arguments.",
                    command=name,
                    num_required_args=args.len(),
                    num_given_args=&prog_args.len()
                )
            );
        }
        // We don't warn if there are too many and we're not inserting the rest with `%%` later because that would mean checking every potential subcommand for `%%` as well if they exist
        let mut with_args = cmd_str.to_string();
        // We need to know the index so we can correlate to the index of the argument in `args`
        for (idx, arg) in args.iter().enumerate() {
            // The arrays are the same length, see above check
            // All arguments are shown in the command string as `%name` or the like, so we get that whole string
            let given_value = &prog_args[idx];
            let arg_with_sign = "%".to_string() + arg;
            let new_command = with_args.replace(&arg_with_sign, given_value);
            // We don't check if we changed something because that doesn't work for multistage or ordered subcommands
            with_args = new_command;
        }
        // Get the program args after a certain point so they can be inserted with `%%` if necessary
        // We do this by getting the part of slice after the specific arguments
        let (_, remaining_args) = prog_args.split_at(args.len());
        Ok((with_args, remaining_args.to_vec())) // FIXME
    }
fn interpolate_specific_args ( cmd_str : & str , name : & str , args : & [ String ] , prog_args : & [ String ] , ) -> Result < ( String , Vec < String > ) , String > { // Check if the correct number of arguments was provided // Even if we're inserting the rest later, we still need the mandatory ones if args . len ( ) > prog_args . len ( ) { return Err ( format ! ( " " command name num_required_args args len ( ) num_given_args prog_args len ( ) ) ) ; } // We don't warn if there are too many and we're not inserting the rest with `%%` later because that would mean checking every potential subcommand for `%%` as well if they exist let mut with_args = cmd_str . to_string ( ) ; // We need to know the index so we can correlate to the index of the argument in `args` for ( idx , arg ) in args . iter ( ) . enumerate ( ) { // The arrays are the same length, see above check // All arguments are shown in the command string as `%name` or the like, so we get that whole string let given_value = & prog_args [ idx ] ; let arg_with_sign = " " . to_string ( ) + arg ; let new_command = with_args . replace ( & arg_with_sign , given_value ) ; // We don't check if we changed something because that doesn't work for multistage or ordered subcommands with_args = new_command ; } // Get the program args after a certain point so they can be inserted with `%%` if necessary // We do this by getting the part of slice after the specific arguments let ( _ , remaining_args ) = prog_args . split_at ( args . len ( ) ) ; Ok ( ( with_args , remaining_args . to_vec ( ) ) ) // FIXME }
Interpolates specific arguments (doesn't handle `%%`)
This takes a string to interpolate into and doesn't take `self` so the order is open
This returns the readied command string and the remaining arguments or an error if an argument couldn't be substituted in
Errors for when the argument can't be interpolated can be silenced for ordered subcommands (which have a universal argument list for many subcommands)
Interpolates specific arguments ( doesn ' t handle ` %% ` ) This takes a string to interpolate into and doesn ' t take ` self ` so the order is open This returns the readied command string and the remaining arguments or an error if an argument couldn ' t be substituted in Errors for when the argument can ' t be interpolated can be silenced for ordered subcommands ( which have a universal argument list for many subcommands )
cmd_str
&str
name
&str
args
&[String]
prog_args
&[String]