From c2a23b89a440effa750478d9954e383b9ca95459 Mon Sep 17 00:00:00 2001 From: Ganesh Gore Date: Thu, 5 May 2022 10:14:53 -0600 Subject: [PATCH] Minor enhancement of shortcuts --- openfpga.sh | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/openfpga.sh b/openfpga.sh index 043f4a678..b9b424a37 100755 --- a/openfpga.sh +++ b/openfpga.sh @@ -74,7 +74,9 @@ run-flow () { # lists all the configure task in task directory list-tasks () { - check_execution_path "$(pwd)" + echo "Repository Task" + tree -P 'task.conf' --prune $OPENFPGA_TASK_PATH | sed "/.* task.conf/d" | sed "/.* config/d" | sed '$d' + echo "Local Task" tree -P 'task.conf' --prune | sed "/.* task.conf/d" | sed "/.* config/d" | sed '$d' } @@ -96,6 +98,8 @@ goto-task () { return fi goto_path=$OPENFPGA_TASK_PATH/$1 + if [ -d $1 ]; then goto_path=./$1; fi + echo $goto_path # Selects the run directory run_num="" if [ ! -d $goto_path ]; then echo "Task directory not found"; return; fi @@ -130,12 +134,18 @@ fi command -v shopt && shopt -s globstar # TaskList=$(ls -tdalh ${OPENFPGA_TASK_PATH}/* | awk '{system("basename " $9)}' | awk '{printf("%s ",$1)}') -TaskList=$(ls -tdalh ${OPENFPGA_TASK_PATH}/**/task.conf | +RepoTaskList=$(ls -tdalh ${OPENFPGA_TASK_PATH}/**/task.conf | awk '{print $9}' | sed -e "s/\/config\/task.conf//" | sed -e "s/${OPENFPGA_PATH//\//\\/}\/openfpga_flow\/tasks\///" | awk '{printf("%s ",$1)}') -complete -W "${TaskList}" goto-task -complete -W "${TaskList}" run-task -complete -W "${TaskList}" run-shell-task -complete -W "${TaskList}" run-modelsim +_TaskList() +{ + local cur + COMPREPLY+=($( ls -R ./*/*/task.conf | sed -e "s/\/config\/task.conf//" | sed -e "s/^\.\///" | awk '{printf("%s ",$1)}' ) ) +} + +complete -W "${RepoTaskList}" -F _TaskList goto-task +complete -W "${RepoTaskList}" -F _TaskList run-task +complete -W "${RepoTaskList}" -F _TaskList run-modelsim +complete -W "${RepoTaskList}" create-task