diff options
author | Soispha <soispha@vhack.eu> | 2023-09-05 23:13:07 +0200 |
---|---|---|
committer | Soispha <soispha@vhack.eu> | 2023-09-05 23:30:26 +0200 |
commit | c7ac8964d4b923afd7d41e81d616f8991a164e23 (patch) | |
tree | 4a5fde43f88a14df422da59869b42299c882f7d2 /hm | |
parent | chore(version): v1.11.0 (diff) | |
download | nixos-config-c7ac8964d4b923afd7d41e81d616f8991a164e23.tar.gz nixos-config-c7ac8964d4b923afd7d41e81d616f8991a164e23.zip |
Fix(hm/pkgs/scritps/neorg): Add ability to access workspace directly
Diffstat (limited to '')
-rwxr-xr-x | hm/soispha/pkgs/scripts/wrappers/neorg | 58 |
1 files changed, 56 insertions, 2 deletions
diff --git a/hm/soispha/pkgs/scripts/wrappers/neorg b/hm/soispha/pkgs/scripts/wrappers/neorg index 29c74c58..29060c97 100755 --- a/hm/soispha/pkgs/scripts/wrappers/neorg +++ b/hm/soispha/pkgs/scripts/wrappers/neorg @@ -3,12 +3,66 @@ # shellcheck source=/dev/null SHELL_LIBRARY_VERSION="1.3.1" . %SHELL_LIBRARY_PATH +# these are used in version() AUTHORS="Soispha" YEARS="2023" +VERSION="1.0.0" -# Start neovim and automatically enable neorg. +NAME="neorg" -nvim -c "NeorgStart" -s "$(tmp "printf ':Neorg workspace '")" +help() { +cat << EOF +This is a quick wrapper to make starting neorg easier. +Usage: + $NAME [--help|--version] <neorg workspace> + +Options: + --help | -h + Display this help and exit. + --version | -v + Display version and copyright information and exit. + <neorg workspace> + The neorg workspace to open at startup, an empty value drops + you at a prompt to enter the workspace yourself +EOF +} + +run_with_workspace() { + nvim -c "NeorgStart" -s "$(ptmp ":Neorg workspace $1\n")" +} +run_without_workspace() { + nvim -c "NeorgStart" -s "$(ptmp ":Neorg workspace ")" +} + +neorg_workspace=""; +run=true; + +while [ "$#" -ne 0 ]; do + case "$1" in + "--help" | "-h") + if [ "$run" = true ]; then + help + fi + run=false; + ;; + "--version" | "-v") + if [ "$run" = true ]; then + version + fi + run=false; + ;; + *) + neorg_workspace="$1"; + ;; + esac + shift 1 +done + +if [ "$neorg_workspace" ] && [ "$run" = true ];then + run_with_workspace "$neorg_workspace"; +elif [ "$run" = true ]; then + run_without_workspace +fi # vim: ft=sh |