From eeddf4454d7aea0e50ba7fe12c8c3a04ff77f965 Mon Sep 17 00:00:00 2001 From: Michael Housh Date: Wed, 19 Jan 2022 09:32:09 -0500 Subject: [PATCH] Updated swift-zet commands --- macOS/.config/macOS/Brewfile | 2 +- scripts/scripts/hcpn | 17 +------ zet/setup | 96 ------------------------------------ zet/zet/config.json | 3 -- zet/zet/hcp-config.json | 3 -- 5 files changed, 3 insertions(+), 118 deletions(-) delete mode 100755 zet/setup delete mode 100644 zet/zet/config.json delete mode 100644 zet/zet/hcp-config.json diff --git a/macOS/.config/macOS/Brewfile b/macOS/.config/macOS/Brewfile index bf0efa0..1432d15 100644 --- a/macOS/.config/macOS/Brewfile +++ b/macOS/.config/macOS/Brewfile @@ -21,7 +21,7 @@ brew "pure" # for cli prompt brew "ripgrep" brew "stow" # for dotfile linking / placement. brew "swift-format" # for formatting swift files -brew "swift-zet" # for managing zettelkasten notes +brew "m-housh/formulae/swift-zet" # for managing zettelkasten notes brew "tmux" # terminal multi-plexer brew "vim" brew "zsh" diff --git a/scripts/scripts/hcpn b/scripts/scripts/hcpn index c7cc451..1f4a7c1 100755 --- a/scripts/scripts/hcpn +++ b/scripts/scripts/hcpn @@ -1,24 +1,11 @@ -#!/bin/sh +#!/bin/bash set -e # Creates a new `zet` inside the House Call Pro `Zettlekasten` _main() { - config="$HOME/.config/zet/hcp-config.json" - cmd="${1}" - shift - - case "$cmd" in - config) - zet config "$config" "$*";; - *) - break;; - esac - if [ "$#" -eq 0 ]; then - zet "$cmd" --config "$config" && exit "$?"; - fi - zet "$cmd" --config "$config" "$*" + (ZETDIR="$HCP_NOTES" eval zet "$@") } _main "$@" diff --git a/zet/setup b/zet/setup deleted file mode 100755 index 43e92f8..0000000 --- a/zet/setup +++ /dev/null @@ -1,96 +0,0 @@ -#!/bin/sh - -config="${HOME}/.config" -uninstall=1 -remove=1 -copy=1 -link=0 - -_usage() { - printf "\n" >&2 - printf "Usage: setup [OPTIONS]\n" >&2 - printf "\n" >&2 - printf "Installs or Uninstalls zet configuration files.\n" >&2 - printf "\n" >&2 - printf "Options:\n" >&2 - printf "\t-c | --copy : Copy the configuration files, instead of creating symlinks.\n" >&2 - printf "\t-h | --help : Print usage information.\n" >&2 - printf "\t-l | --link : Create symlinks to the configuration files (Default).\n" >&2 - printf "\t-r | --remove : Removes the entire ~/.config/zet directory.\n" >&2 - printf "\t-u | --uninstall : Uninstalls configuration files.\n" >&2 - printf "\n" >&2 - printf "If called without the uninstall option then it will install the configuration files.\n" >&2 - printf "The copy and link options are ignored if called with the uninstall or remove option.\n" >&2 - printf "\n" >&2 -} - -_parse_options() { - arg= - while ! test -z "$1"; do - arg="$1" - case $arg in - -c | --copy) - copy=0 - link=1 - shift;; - -h | --help) - _usage - exit;; - -l | --link) - copy=1 - link=0 - shift;; - -r | --remove) - remove=0 - shift;; - -u | --uninstall) - uninstall=0 - shift;; - *) - echo "Unknown option $arg" >&2 - shift;; - esac - done -} - -_make_dirs() { - if ! test -d "${config}"; then - mkdir "${config}" - fi -} - -_remove_zet() { - echo "Removing zet directory..." - test -d "${config}/zet" && rm -r "${config}/zet" -} - -_link_zet() { - echo "Linking git configuration..." - ln -sfv "${PWD}/zet" "${config}" -} - -_copy_zet() { - echo "Copying zet configuration..." - cp -r "${PWD}/zet" "${config}" -} - -_install() { - _make_dirs - - test "$copy" -eq 0 && _copy_zet && return "$?" - test "$link" -eq 0 && _link_zet && return "$?" - echo "Neither link or copy was passed, see --help for usage" - exit 1 -} - -#------------------------------- main ------------------------------- -main() { - _parse_options "$@" - - test "$remove" -eq 0 && _remove_zet && exit "$?" - test "$uninstall" -eq 0 && _remove_zet && exit "$?" - - _install && exit "$?" -} - -main "$@" diff --git a/zet/zet/config.json b/zet/zet/config.json deleted file mode 100644 index 016873b..0000000 --- a/zet/zet/config.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "zetDirectory" : "/Volumes/Bucket/Repos/github.com/m-housh/zets" -} \ No newline at end of file diff --git a/zet/zet/hcp-config.json b/zet/zet/hcp-config.json deleted file mode 100644 index 1ff0943..0000000 --- a/zet/zet/hcp-config.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "zetDirectory" : "/Volumes/Bucket/Repos/github.com/hhe-dev/hcp-notes" -} \ No newline at end of file