diff --git a/src/bin/main.rs b/src/bin/main.rs index e6b7c95..aad678a 100644 --- a/src/bin/main.rs +++ b/src/bin/main.rs @@ -28,6 +28,7 @@ fn main() { // FIXME-BENCHMARK: Benchmark other option like structOpt (https://docs.rs/structopt/0.3.7/structopt/#subcommands) // FIXME-TEST: Add test to make sure that clap works the way we want it + // FIXME: Define arguments based on their presence in src/subcoms/rustlang/ -- https://github.com/RXT0112/Zernit/issues/54 let matches = App::new("RXT0112") .version("INIT_PHASE_VERSION") // Replace with valid versioning .author("Jacob Hrbek ") @@ -37,6 +38,11 @@ fn main() { .long("gui") .multiple(true) .help("Opens up a Graphical User Interface frontend")) + .arg(Arg::with_name("noninteractive") + .short("I") + .long("noninteractive") + .multiple(true) + .help("Opens up a Graphical User Interface frontend")) .arg(Arg::with_name("dev") .short("D") .long("development") diff --git a/src/bin/main.sh b/src/bin/main.sh index e7bf7cd..7444f7d 100644 --- a/src/bin/main.sh +++ b/src/bin/main.sh @@ -1,23 +1,39 @@ #!/bin/sh -printf '%s\n' "ping" +# Source kreypi's output functions +for libs in src/libs/shell/kreypi/output/*; do + . "src/libs/shell/kreypi/output/$libs" +done -# Simplified assertion -die() { - printf 'FATAL: %s\n' "$2" - exit "$1" -} +# Source assertion function +. src/libs/shell/kreypi/terminators/die.sh -fixme() { - [ -z "$IGNORE_FIXME" ] && printf 'FIXME: %s\n' "$1" -} +subcomdir="src/subcoms/shell/" # Argument management -while [ $# -ge 1 ]; do case $1 in - --help|-h|help) - fixme "Help message here" - shift 1 - ;; - *) - die 2 "FIXME: Syntax error" -esac; done \ No newline at end of file +## NOTICE: This is used to source arguments based on filenames in subcomdir +efixme "Check security of argument management" +code=':' +for file in "$subcomdir/*"; do + [ ! -f "$file" ] && die 1 "Unable to find a file '$file' in $subcomdir " + # To avoid code injection + case $file in *[![:alnum:]]*) + die 1 "CODE_INJECTION_WARNING: Unsafe name encountered - $file" ;; + esac + code="$code | \"$file\"" +done +eval "$code" + +# LEGACY: Remove me once ready +# while [ $# -ge 1 ]; do case "$1" in +# --help|-h|help) +# efixme "Help message here" +# shift 1 +# ;; +# command1 | command2 | command3 | command4) +# something ;; +# $(for file in src/subcoms/shell/*; do printf '%s\n' "$file | "; done)X) +# efixme "Provide logic to execute subcommands" ;; +# *) +# die 2 "FIXME: Syntax error" +# esac; done \ No newline at end of file diff --git a/src/libs/README.md b/src/libs/README.md new file mode 100644 index 0000000..9be8d6b --- /dev/null +++ b/src/libs/README.md @@ -0,0 +1 @@ +Directory for various third party libraries to which we need write access \ No newline at end of file diff --git a/src/libs/shell/kreypi b/src/libs/shell/kreypi new file mode 160000 index 0000000..6410e01 --- /dev/null +++ b/src/libs/shell/kreypi @@ -0,0 +1 @@ +Subproject commit 6410e013192a9640ebcdfbf0668eb85d4ed67a16