YoU cAnT dO tHiS iN ShElL kReY

This commit is contained in:
Kreyren 2020-02-17 23:04:54 +00:00
parent 51c5134ba4
commit ee5babc999
4 changed files with 41 additions and 17 deletions

@ -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/<SUBCOMMAND> -- https://github.com/RXT0112/Zernit/issues/54
let matches = App::new("RXT0112")
.version("INIT_PHASE_VERSION") // Replace with valid versioning
.author("Jacob Hrbek <kreyren@rixotstudio.cz>")
@ -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")

@ -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
## 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

1
src/libs/README.md Normal file

@ -0,0 +1 @@
Directory for various third party libraries to which we need write access

1
src/libs/shell/kreypi Submodule

@ -0,0 +1 @@
Subproject commit 6410e013192a9640ebcdfbf0668eb85d4ed67a16