cmd_lib_macros 2.0.0

Common rust commandline macros and utils, to write shell script like tasks easily
Documentation

cmd_lib_macros - Procedural macros for cmd_lib

Invalid syntax examples that should fail to compile

This section contains documentation tests that demonstrate invalid macro syntax which should result in compilation errors. These serve as tests to ensure the macros properly reject invalid input.

Invalid variable expansion syntax

Variable names cannot start with numbers:

# use cmd_lib::*;
run_cmd!(echo "${msg0}");

Invalid spacing in variable expansion:

# use cmd_lib::*;
run_fun!(echo "${ msg }");

Unclosed variable expansion:

# use cmd_lib::*;
run_fun!(echo "${");

Unclosed variable name:

# use cmd_lib::*;
run_fun!(echo "${msg");

Variable names cannot be numbers:

# use cmd_lib::*;
run_fun!(echo "${0}");

Variable names cannot have spaces:

# use cmd_lib::*;
run_fun!(echo "${ 0 }");

Variable names cannot start with numbers:

# use cmd_lib::*;
run_fun!(echo "${0msg}");

Variable names cannot contain spaces:

# use cmd_lib::*;
run_fun!(echo "${msg 0}");

Invalid redirect syntax

Invalid redirect operator spacing:

# use cmd_lib::*;
run_cmd!(ls > >&1);

Invalid redirect to stdout:

# use cmd_lib::*;
run_cmd!(ls >>&1);

Invalid redirect to stderr:

# use cmd_lib::*;
run_cmd!(ls >>&2);

Double redirect errors

Triple redirect operator:

# use cmd_lib::*;
run_cmd!(ls / /x &>>> /tmp/f);

Double redirect with space:

# use cmd_lib::*;
run_cmd!(ls / /x &> > /tmp/f);

Double output redirect:

# use cmd_lib::*;
run_cmd!(ls / /x > > /tmp/f);

Append and output redirect:

# use cmd_lib::*;
run_cmd!(ls / /x >> > /tmp/f);