From 390978ea83757ced34b5bb0a766f6186f50334ec Mon Sep 17 00:00:00 2001 From: siyangy Date: Fri, 4 Aug 2017 20:18:42 -0700 Subject: [PATCH] refactor apoll_base.sh to allow taking additional args --- scripts/apollo_base.sh | 13 +++++++------ scripts/canbus.sh | 2 +- scripts/control.sh | 2 +- scripts/decision.sh | 2 +- scripts/dreamview.sh | 2 +- scripts/dreamview_sim_control.sh | 2 +- scripts/localization.sh | 2 +- scripts/perception.sh | 2 +- scripts/planning.sh | 2 +- scripts/prediction.sh | 2 +- scripts/routing.sh | 2 +- 11 files changed, 17 insertions(+), 16 deletions(-) diff --git a/scripts/apollo_base.sh b/scripts/apollo_base.sh index f0a652b8ef..284b827e58 100755 --- a/scripts/apollo_base.sh +++ b/scripts/apollo_base.sh @@ -202,23 +202,24 @@ function help() { # run command_name module_name function run() { - local cmd=$1 - shift + local module=$1 + local cmd=$2 + shift 2 case $cmd in start) - start "$@" + start $module "$@" ;; start_fe) - start_fe "$@" + start_fe $module "$@" ;; stop) - stop "$1" + stop $module ;; help) help ;; *) - start "$@" + start $module "$@" ;; esac } diff --git a/scripts/canbus.sh b/scripts/canbus.sh index e06b688070..1c0809835b 100755 --- a/scripts/canbus.sh +++ b/scripts/canbus.sh @@ -25,4 +25,4 @@ source "$DIR/apollo_base.sh" # run function from apollo_base.sh # run command_name module_name -run "$1" canbus +run canbus "$@" diff --git a/scripts/control.sh b/scripts/control.sh index 7674a05815..09c54deecd 100755 --- a/scripts/control.sh +++ b/scripts/control.sh @@ -23,4 +23,4 @@ source "${DIR}/apollo_base.sh" # run function from apollo_base.sh # run command_name module_name -run "$1" control +run control "$@" diff --git a/scripts/decision.sh b/scripts/decision.sh index 70dcbbcad3..809eb5b12a 100755 --- a/scripts/decision.sh +++ b/scripts/decision.sh @@ -25,4 +25,4 @@ source "${DIR}/apollo_base.sh" # run function from apollo_base.sh # run command_name module_name -run "$1" decision +run decision "$@" diff --git a/scripts/dreamview.sh b/scripts/dreamview.sh index 5d361e0953..fd78eb854d 100755 --- a/scripts/dreamview.sh +++ b/scripts/dreamview.sh @@ -25,4 +25,4 @@ source "${DIR}/apollo_base.sh" # run function from apollo_base.sh # run command_name module_name -run "$1" dreamview +run dreamview "$@" diff --git a/scripts/dreamview_sim_control.sh b/scripts/dreamview_sim_control.sh index dc70bc771f..c0f0ff78e7 100755 --- a/scripts/dreamview_sim_control.sh +++ b/scripts/dreamview_sim_control.sh @@ -25,4 +25,4 @@ source "${DIR}/apollo_base.sh" # run function from apollo_base.sh # run command_name module_name -run "$1" dreamview --enable_sim_control=true +run dreamview "$@" --enable_sim_control=true diff --git a/scripts/localization.sh b/scripts/localization.sh index a1874acb05..7129539ef0 100755 --- a/scripts/localization.sh +++ b/scripts/localization.sh @@ -23,4 +23,4 @@ source "${DIR}/apollo_base.sh" # run function from apollo_base.sh # run command_name module_name -run "$1" localization +run localization "$@" diff --git a/scripts/perception.sh b/scripts/perception.sh index 4edfea83a9..3c59976aab 100755 --- a/scripts/perception.sh +++ b/scripts/perception.sh @@ -23,4 +23,4 @@ source "${DIR}/apollo_base.sh" # run function from apollo_base.sh # run command_name module_name -run "$1" perception +run perception "$@" diff --git a/scripts/planning.sh b/scripts/planning.sh index ee98fa618e..0b3ce383b2 100755 --- a/scripts/planning.sh +++ b/scripts/planning.sh @@ -23,4 +23,4 @@ source "${DIR}/apollo_base.sh" # run function from apollo_base.sh # run command_name module_name -run "$1" planning +run planning "$@" diff --git a/scripts/prediction.sh b/scripts/prediction.sh index cc8325a2ab..05d9790377 100755 --- a/scripts/prediction.sh +++ b/scripts/prediction.sh @@ -23,4 +23,4 @@ source "${DIR}/apollo_base.sh" # run function from apollo_base.sh # run command_name module_name -run "$1" prediction +run prediction "$@" diff --git a/scripts/routing.sh b/scripts/routing.sh index f5976bf82c..d362c57073 100755 --- a/scripts/routing.sh +++ b/scripts/routing.sh @@ -23,4 +23,4 @@ source "${DIR}/apollo_base.sh" # run function from apollo_base.sh # run command_name module_name -run "$1" routing +run routing "$@" -- GitLab