-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update mock executable to process args
- Loading branch information
Showing
3 changed files
with
136 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,59 @@ | ||
#!/usr/bin/env bash | ||
|
||
echo "-----------RUNNING MOCK LOUPER EXECUTABLE--------------" | ||
echo Arguments passed to the script: "$@" | ||
|
||
# Default values | ||
force=false | ||
|
||
# Check if the correct number of arguments is provided | ||
if [ "$#" -lt 3 ] || [ "$#" -gt 4 ]; then | ||
echo "Usage: $0 create --input=SOME_PATH --output=SOME_PATH [--force]" | ||
exit 1 | ||
fi | ||
|
||
# Check if the first argument is "create" | ||
if [ "$1" != "create" ]; then | ||
echo "Error: First argument must be 'create'" | ||
exit 1 | ||
fi | ||
|
||
# shift args | ||
shift | ||
|
||
# Parse and validate the input and output options | ||
input="" | ||
output="" | ||
|
||
while [ "$#" -gt 0 ]; do | ||
case "$1" in | ||
--input=*) | ||
input="${1#*=}" | ||
;; | ||
--output=*) | ||
output="${1#*=}" | ||
;; | ||
--force) | ||
force=true | ||
;; | ||
*) | ||
echo "Error: Unknown option '$1'" | ||
exit 1 | ||
;; | ||
esac | ||
shift | ||
done | ||
|
||
# Check if input and output paths are provided | ||
if [ -z "$input" ] || [ -z "$output" ]; then | ||
echo "Error: Both --input and --output options must be provided" | ||
exit 1 | ||
fi | ||
|
||
# Additional processing with the arguments can be added here | ||
|
||
echo "Action: create" | ||
echo "Input path: $input" | ||
echo "Output path: $output" | ||
echo "Force: $force" | ||
|
||
echo "-------------------------------------------------------" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,66 @@ | ||
@echo off | ||
|
||
echo "-----------RUNNING MOCK LOUPER.BAT EXECUTABLE--------------" | ||
echo Arguments passed to the script: %* | ||
|
||
setlocal enabledelayedexpansion | ||
|
||
set "force=false" | ||
|
||
REM Check if the correct number of arguments is provided | ||
if "%~1" neq "create" ( | ||
echo Error: First argument must be 'create' | ||
goto :eof | ||
) | ||
shift | ||
|
||
REM Parse and validate the input and output options | ||
set "input=" | ||
set "output=" | ||
|
||
:parse_args | ||
if "%~1" equ "" goto :check_paths | ||
|
||
if /i "%~1" equ "--input" ( | ||
set "input=%~2" | ||
shift | ||
shift | ||
goto :parse_args | ||
) | ||
|
||
if /i "%~1" equ "--output" ( | ||
set "output=%~2" | ||
shift | ||
shift | ||
goto :parse_args | ||
) | ||
|
||
if /i "%~1" equ "--force" ( | ||
set "force=true" | ||
shift | ||
goto :parse_args | ||
) | ||
|
||
echo Error: Unknown option '%1' | ||
goto :eof | ||
|
||
:check_paths | ||
REM Check if input and output paths are provided | ||
if not defined input ( | ||
echo Error: --input option must be provided | ||
goto :eof | ||
) | ||
|
||
if not defined output ( | ||
echo Error: --output option must be provided | ||
goto :eof | ||
) | ||
|
||
REM Additional processing with the arguments can be added here | ||
|
||
echo Action: create | ||
echo Input path: !input! | ||
echo Output path: !output! | ||
echo Force: !force! | ||
|
||
:end | ||
echo "-----------------------------------------------------------" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters