diff options
| -rw-r--r-- | dotfiles/fish/conf.d/config.fish | 3 | ||||
| -rw-r--r-- | dotfiles/fish/conf.d/supersync.fish (renamed from dotfiles/fish/conf.d/sync.fish) | 30 | ||||
| -rw-r--r-- | dotfiles/fish/conf.d/worktime.fish | 9 |
3 files changed, 23 insertions, 19 deletions
diff --git a/dotfiles/fish/conf.d/config.fish b/dotfiles/fish/conf.d/config.fish index cb5a8a6..39fcf04 100644 --- a/dotfiles/fish/conf.d/config.fish +++ b/dotfiles/fish/conf.d/config.fish @@ -14,9 +14,6 @@ abbr -a no 'grep -E -i -v' abbr -a gl 'git log --pretty=oneline --graph --decorate --all' abbr -a gp 'begin; git commit -a; and git pull; and git push; end' -# TODO: Rewrite, to use $fish_function_path -# Apparently, the conf.d directories are set up by fisher? -# Maybe use ~/confg/fish/functions/ instead? for dir in ~/.config/fish/conf.d.work ~/.config/fish/conf.d.local if test -d $dir for file in $dir/*.fish diff --git a/dotfiles/fish/conf.d/sync.fish b/dotfiles/fish/conf.d/supersync.fish index 2fc2bec..8ccd11e 100644 --- a/dotfiles/fish/conf.d/sync.fish +++ b/dotfiles/fish/conf.d/supersync.fish @@ -1,10 +1,10 @@ -set -x SYNC_STAMP_FILE ~/.sync.last +set -x SUPERSYNC_STAMP_FILE ~/.supersync.last -function sync::is_it_time_to_sync +function supersync::is_it_time_to_sync set -l max_age 86400 set -l now (date +%s) - if test -f $SYNC_STAMP_FILE - set -l diff (math $now - (cat $SYNC_STAMP_FILE)) + if test -f $SUPERSYNC_STAMP_FILE + set -l diff (math $now - (cat $SUPERSYNC_STAMP_FILE)) if test $diff -lt $max_age return 0 end @@ -13,7 +13,7 @@ function sync::is_it_time_to_sync end # Only sync the HabitsAndQuotes when it's asked for via function parameter -function sync::worktime +function supersync::worktime set -l worktime_dir ~/git/worktime if not test -d $worktime_dir @@ -46,7 +46,7 @@ function sync::worktime cd - end -function sync::uprecords +function supersync::uprecords set -l uprecords_dir ~/git/uprecords set -l uprecords_repo git@codeberg.org:snonux/uprecords.git @@ -64,7 +64,7 @@ function sync::uprecords cd - end -function sync::taskwarrior +function supersync::taskwarrior if test -f ~/scripts/taskwarriorfeeder.rb ruby ~/scripts/taskwarriorfeeder.rb else @@ -75,18 +75,16 @@ function sync::taskwarrior taskwarrior::import end -function sync - sync::worktime sync_quotes - sync::taskwarrior - sync::worktime no_sync_quotes - sync::uprecords +function supersync + supersync::worktime sync_quotes + supersync::taskwarrior + supersync::worktime no_sync_quotes + supersync::uprecords if which gos >/dev/null gos end - date +%s >$SYNC_STAMP_FILE.tmp - mv $SYNC_STAMP_FILE.tmp $SYNC_STAMP_FILE + date +%s >$SUPERSYNC_STAMP_FILE.tmp + mv $SUPERSYNC_STAMP_FILE.tmp $SUPERSYNC_STAMP_FILE end - -abbr -g supersync sync diff --git a/dotfiles/fish/conf.d/worktime.fish b/dotfiles/fish/conf.d/worktime.fish index 2b900a3..f2f7f5d 100644 --- a/dotfiles/fish/conf.d/worktime.fish +++ b/dotfiles/fish/conf.d/worktime.fish @@ -8,6 +8,14 @@ function worktime ruby $WORKTIME_DIR/worktime.rb $argv end +function worktime::sync + cd $WORKTIME_DIR + git commit -a -m sync + git pull + git push + cd - +end + function worktime::wisdom_reminder if test -f $WORKTIME_DIR/work-wisdoms.md sed -n '/^\* / { s/\* //; p; }' $WORKTIME_DIR/work-wisdoms.md | sort -R | head -n 1 @@ -105,6 +113,7 @@ abbr -a wtlog 'worktime::log' abbr -a wtlogin 'worktime::login' abbr -a wtlogout 'worktime::logout' abbr -a wtstatus 'worktime::status' +abbr -a wtsync 'worktime::sync' abbr -a wtf 'worktime --report' abbr -a random_exercise "sort -R $WORKTIME_DIR/exercises.md | head -n 1" abbr -a random_exercises "sort -R $WORKTIME_DIR/exercises.md | head -n 10" |
