diff options
Diffstat (limited to 'hm/soispha/pkgs/scripts/specific/neorg/sh/main.sh')
-rwxr-xr-x | hm/soispha/pkgs/scripts/specific/neorg/sh/main.sh | 129 |
1 files changed, 64 insertions, 65 deletions
diff --git a/hm/soispha/pkgs/scripts/specific/neorg/sh/main.sh b/hm/soispha/pkgs/scripts/specific/neorg/sh/main.sh index 25b434fc..dc746ef8 100755 --- a/hm/soispha/pkgs/scripts/specific/neorg/sh/main.sh +++ b/hm/soispha/pkgs/scripts/specific/neorg/sh/main.sh @@ -14,7 +14,6 @@ SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH . ./functions/utils . ./functions/workspace - # these are used in version() # shellcheck disable=2034 AUTHORS="Soispha" @@ -24,7 +23,7 @@ YEARS="2023" NAME="neorg" help() { -cat << EOF + cat <<EOF This is the core interface to the system-integrated task management USAGE: @@ -82,75 +81,75 @@ EOF for arg in "$@"; do case "$arg" in - "--help" | "-h") - help; - exit 0; - ;; - "--version" | "-v") - version; - exit 0; - ;; + "--help" | "-h") + help + exit 0 + ;; + "--version" | "-v") + version + exit 0 + ;; esac done while [ "$#" -ne 0 ]; do case "$1" in - "t"*) # task - shift 1; - task_id="$1"; - [ "$task_id" ] || utils0chain context0open_current_task_context "exit 0" - context0open_current_task_context_at_task_id "$task_id"; - exit 0; - ;; - "w"*) # workspace - shift 1; - workspace_to_open="$1"; - # TODO: Exit with 1 on error, instead of the 0 <2023-10-20> - [ "$workspace_to_open" ] || utils0chain workspace0open_neorg_workspace_prompt "exit 0"; - workspace0open_neorg_workspace "$workspace_to_open"; - exit 0; - ;; - "p"*) # project - shift 1; - project_to_open="$1"; - # TODO: Exit with 1 on error, instead of the 0 <2023-10-20> - [ "$project_to_open" ] || utils0chain project0open_current_context_in_browser "exit 0"; - if ! grep -q "$project_to_open" "$(ptmp "%ALL_PROJECTS_NEWLINE")"; then - die "Your project ('$project_to_open') is not in the list of available projects: -%ALL_PROJECTS_COMMA"; - fi - project0open_project_in_browser "$project_to_open"; - exit 0; - ;; - "l"*) # list - list0list_all_contexts_newline; - exit 0 - ;; - "a"*) # add-project - add0open_taskwarrior_project_file; - exit 0 - ;; - "d"*) # dmenu - dmenu0open_context_in_browser; - exit 0 - ;; - "fsta"*) # fstart - shift 1; - task_id="$1"; - [ "$task_id" ] || die "No task id provided to fstart"; - fstart0start_new_task "$task_id"; - exit 0 - ;; - "fsto"*) # fstop - fstop0stop_current_task; - exit 0 - ;; - *) - die "Command '$1' does not exist! Please look at:\n $NAME --help"; - exit 0; - ;; + "t"*) # task + shift 1 + task_id="$1" + [ "$task_id" ] || utils0chain context0open_current_task_context "exit 0" + context0open_current_task_context_at_task_id "$task_id" + exit 0 + ;; + "w"*) # workspace + shift 1 + workspace_to_open="$1" + # TODO: Exit with 1 on error, instead of the 0 <2023-10-20> + [ "$workspace_to_open" ] || utils0chain workspace0open_neorg_workspace_prompt "exit 0" + workspace0open_neorg_workspace "$workspace_to_open" + exit 0 + ;; + "p"*) # project + shift 1 + project_to_open="$1" + # TODO: Exit with 1 on error, instead of the 0 <2023-10-20> + [ "$project_to_open" ] || utils0chain project0open_current_context_in_browser "exit 0" + if ! grep -q "$project_to_open" "$(ptmp "%ALL_PROJECTS_NEWLINE")"; then + die "Your project ('$project_to_open') is not in the list of available projects: +%ALL_PROJECTS_COMMA" + fi + project0open_project_in_browser "$project_to_open" + exit 0 + ;; + "l"*) # list + list0list_all_contexts_newline + exit 0 + ;; + "a"*) # add-project + add0open_taskwarrior_project_file + exit 0 + ;; + "d"*) # dmenu + dmenu0open_context_in_browser + exit 0 + ;; + "fsta"*) # fstart + shift 1 + task_id="$1" + [ "$task_id" ] || die "No task id provided to fstart" + fstart0start_new_task "$task_id" + exit 0 + ;; + "fsto"*) # fstop + fstop0stop_current_task + exit 0 + ;; + *) + die "Command '$1' does not exist! Please look at:\n $NAME --help" + exit 0 + ;; esac done -context0open_current_task_context; +context0open_current_task_context # vim: ft=sh |