[fish] Updating gitnow and adding ffsftp func

This commit is contained in:
2021-08-20 09:45:32 -04:00
parent ad05345e50
commit 92bb863f89
5 changed files with 55 additions and 11 deletions

View File

@ -131,7 +131,7 @@ function pull -d "Gitnow: Pull changes from remote server but stashing uncommitt
echo "⚡️ Pulling changes..." echo "⚡️ Pulling changes..."
set -l xdefaults --rebase --autostash set -l xdefaults --rebase --autostash --tags
if test $len -gt 2 if test $len -gt 2
set xcmd $argv set xcmd $argv
@ -176,17 +176,41 @@ function push -d "Gitnow: Push commit changes to remote repository"
set -l xorigin (__gitnow_current_remote) set -l xorigin (__gitnow_current_remote)
set -l xbranch (__gitnow_current_branch_name) set -l xbranch (__gitnow_current_branch_name)
echo "🚀 Pushing changes..."
if test (count $opts) -eq 0 if test (count $opts) -eq 0
set opts $xorigin $xbranch set opts $xorigin $xbranch
set -l xremote_url (command git config --get "remote.$xorigin.url") set -l xremote_url (command git config --get "remote.$xorigin.url")
echo "🚀 Pushing changes..."
echo "Mode: Auto" echo "Mode: Auto"
echo "Remote URL: $xorigin ($xremote_url)" echo "Remote URL: $xorigin ($xremote_url)"
echo "Remote branch: $xbranch" echo "Remote branch: $xbranch"
else else
echo "Mode: Manual" set -l v_mode "auto"
for v in $argv
switch $v
case -t --tags
set opts $xorigin $xbranch --follow-tags
set -l xremote_url (command git config --get "remote.$xorigin.url")
echo "🚀 Pushing changes..."
echo "Mode: Auto (incl. tags)"
echo "Remote URL: $xorigin ($xremote_url)"
echo "Remote branch: $xbranch"
case -h --help
echo "NAME"
echo " Gitnow: push - Push current branch to default origin"
echo "OPTIONS:"
echo " -t --tags (auto mode) include annotated tags that relate to the commits"
echo " -h --help Show information about the options for this command"
return
case -\*
case '*'
set -l v_mode "manual"
echo "Mode: Manual"
end
end
end end
echo echo
@ -471,6 +495,8 @@ function tag -d "Gitnow: Tag commits following Semver"
set -l v_preminor set -l v_preminor
set -l v_prepatch set -l v_prepatch
set -l opts
# NOTE: this function only gets the latest *Semver release version* but no suffixed ones or others # NOTE: this function only gets the latest *Semver release version* but no suffixed ones or others
set -l v_latest (__gitnow_get_latest_semver_release_tag) set -l v_latest (__gitnow_get_latest_semver_release_tag)
@ -482,6 +508,8 @@ function tag -d "Gitnow: Tag commits following Semver"
set v_minor $v set v_minor $v
case -z --patch case -z --patch
set v_patch $v set v_patch $v
case -a --annotate
set opts $opts $v
# TODO: pre-release versions are not supported yet # TODO: pre-release versions are not supported yet
# case -a --premajor # case -a --premajor
@ -513,6 +541,7 @@ function tag -d "Gitnow: Tag commits following Semver"
echo " -y --minor Tag auto-incrementing a minor version number" echo " -y --minor Tag auto-incrementing a minor version number"
echo " -z --patch Tag auto-incrementing a patch version number" echo " -z --patch Tag auto-incrementing a patch version number"
echo " -l --latest Show only the latest Semver release tag version (no suffixed ones or others)" echo " -l --latest Show only the latest Semver release tag version (no suffixed ones or others)"
echo " -a --annotate Create as annotated tag"
echo " -h --help Show information about the options for this command" echo " -h --help Show information about the options for this command"
# TODO: pre-release versions are not supported yet # TODO: pre-release versions are not supported yet
@ -528,7 +557,7 @@ function tag -d "Gitnow: Tag commits following Semver"
end end
# List all tags in a lexicographic order and treating tag names as versions # List all tags in a lexicographic order and treating tag names as versions
if test -z $argv if test -z "$argv"
__gitnow_get_tags_ordered __gitnow_get_tags_ordered
return return
end end
@ -536,7 +565,7 @@ function tag -d "Gitnow: Tag commits following Semver"
# Major version tags # Major version tags
if test -n "$v_major" if test -n "$v_major"
if not test -n "$v_latest" if not test -n "$v_latest"
command git tag v1.0.0 command git tag $opts v1.0.0
echo "First major tag \"v1.0.0\" was created." echo "First major tag \"v1.0.0\" was created."
return return
else else
@ -553,7 +582,7 @@ function tag -d "Gitnow: Tag commits following Semver"
set x (__gitnow_increment_number $x) set x (__gitnow_increment_number $x)
set -l xyz "$prefix$x.0.0" set -l xyz "$prefix$x.0.0"
command git tag $xyz command git tag $opts $xyz
echo "Major tag \"$xyz\" was created." echo "Major tag \"$xyz\" was created."
return return
end end
@ -563,7 +592,7 @@ function tag -d "Gitnow: Tag commits following Semver"
# Minor version tags # Minor version tags
if test -n "$v_minor" if test -n "$v_minor"
if not test -n "$v_latest" if not test -n "$v_latest"
command git tag v0.1.0 command git tag $opts v0.1.0
echo "First minor tag \"v0.1.0\" was created." echo "First minor tag \"v0.1.0\" was created."
return return
else else
@ -581,7 +610,7 @@ function tag -d "Gitnow: Tag commits following Semver"
set y (__gitnow_increment_number $y) set y (__gitnow_increment_number $y)
set -l xyz "$prefix$x.$y.0" set -l xyz "$prefix$x.$y.0"
command git tag $xyz command git tag $opts $xyz
echo "Minor tag \"$xyz\" was created." echo "Minor tag \"$xyz\" was created."
return return
end end
@ -591,7 +620,7 @@ function tag -d "Gitnow: Tag commits following Semver"
# Patch version tags # Patch version tags
if test -n "$v_patch" if test -n "$v_patch"
if not test -n "$v_latest" if not test -n "$v_latest"
command git tag v0.0.1 command git tag $opts v0.0.1
echo "First patch tag \"v0.1.0\" was created." echo "First patch tag \"v0.1.0\" was created."
return return
else else
@ -613,7 +642,7 @@ function tag -d "Gitnow: Tag commits following Semver"
set s (__gitnow_increment_number $s) set s (__gitnow_increment_number $s)
set -l xyz "$prefix$x.$y.$s" set -l xyz "$prefix$x.$y.$s"
command git tag $xyz command git tag $opts $xyz
echo "Patch tag \"$xyz\" was created." echo "Patch tag \"$xyz\" was created."
else else
echo "No patch version found." echo "No patch version found."

View File

@ -0,0 +1,8 @@
if type -q direnv
function __direnv_export_eval --on-variable PWD
status --is-command-substitution; and return
eval (direnv export fish)
end
else
echo "Install direnv first! Check http://direnv.net" 2>&1
end

View File

@ -3,7 +3,7 @@
SETUVAR FZF_COMPLETE:3 SETUVAR FZF_COMPLETE:3
SETUVAR FZF_DEFAULT_OPTS:\x2d\x2dheight\x2040\x25 SETUVAR FZF_DEFAULT_OPTS:\x2d\x2dheight\x2040\x25
SETUVAR FZF_DISABLE_KEYBINDINGS:0 SETUVAR FZF_DISABLE_KEYBINDINGS:0
SETUVAR FZF_LEGACY_KEYBINDINGS:0 SETUVAR FZF_LEGACY_KEYBINDINGS:1
SETUVAR FZF_PREVIEW_DIR_CMD:ls SETUVAR FZF_PREVIEW_DIR_CMD:ls
SETUVAR FZF_PREVIEW_FILE_CMD:head\x20\x2dn\x2010 SETUVAR FZF_PREVIEW_FILE_CMD:head\x20\x2dn\x2010
SETUVAR FZF_TMUX_HEIGHT:40\x25 SETUVAR FZF_TMUX_HEIGHT:40\x25

View File

@ -7,3 +7,4 @@ oh-my-fish/theme-krisleech
lfiolhais/theme-simple-ass-prompt lfiolhais/theme-simple-ass-prompt
jethrokuan/z jethrokuan/z
jethrokuan/fzf jethrokuan/fzf
python

View File

@ -0,0 +1,6 @@
function ffsftp
echo "Logging in ... "
curl -k --cookie-jar /tmp/cookie -i -H Content-Type\:\ application/x-www-form-urlencoded -XPOST https\://sftp-workday.five.unbl.ink/mobile/login\?debug_api\=1\&check_signature\=false -d email\=workday\@15five.com\&password\=15five
echo "POSTing CSV file $argv.csv to app ... "
curl -k --cookie /tmp/cookie -i -H Content-Type\:\ application/json -XPOST https\://sftp-workday.five.unbl.ink/sftp/receiver/ -d \{\ \"Records\"\:\ \[\ \{\ \"s3\"\:\ \{\ \"object\"\:\ \{\ \"key\"\:\ \"$argv.csv\"\ \}\ \}\ \}\ \]\ \}
end