Last active
October 18, 2017 16:22
-
-
Save burtlo/8424cf6f841a523121ac54516b28376c to your computer and use it in GitHub Desktop.
Revisions
-
lynnvfrank revised this gist
Oct 18, 2017 . 1 changed file with 20 additions and 13 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,9 @@ # Usage # # run pkg_name # Run the latest # run pkg_name HEAD # Run the latest # run pkg_name HEAD~1 # Run the second to last # run pkg_name ~1 # Run the second to last # function run() { local pkg_name=$1 @@ -15,21 +17,26 @@ function run() { for i in ${!found_pkgs[@]}; do current_count=$((pkg_count-1-i)) if [ $current_count == 0 ] ; then indexed_pkgs+=([HEAD]=${found_pkgs[$i]}) else indexed_pkgs+=([HEAD~$current_count]=${found_pkgs[$i]}) indexed_pkgs+=([~$current_count]=${found_pkgs[$i]}) fi done # Run the latest package if no pkg_position has been specified. local pkg_to_run=${indexed_pkgs[HEAD]} # If there is a pkg_position then find that package. Stop if it cannot. if ! [ -z "$pkg_position" ] ; then pkg_to_run=${indexed_pkgs[$pkg_position]} if [ -z "$pkg_to_run" ] ; then echo "Could not find a package at $pkg_position. There are $pkg_count total package(s)." return fi fi echo "Running $pkg_to_run" hab sup start $pkg_to_run } -
lynnvfrank revised this gist
Oct 18, 2017 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -13,7 +13,7 @@ function run() { declare -A indexed_pkgs for i in ${!found_pkgs[@]}; do current_count=$((pkg_count-1-i)) if [ $current_count == 0 ] ; then head_offset="HEAD" else @@ -32,4 +32,4 @@ function run() { echo "Running $pkg_to_run" hab sup start $pkg_to_run } -
lynnvfrank revised this gist
Oct 18, 2017 . 1 changed file with 5 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,8 @@ # Usage: # # $ run pkg_name HEAD # $ run pkg_name HEAD~1 # function run() { local pkg_name=$1 local pkg_position=$2 -
lynnvfrank renamed this gist
Oct 18, 2017 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
lynnvfrank created this gist
Oct 18, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,32 @@ # run pkg_name HEAD # run pkg_name HEAD~1 function run() { local pkg_name=$1 local pkg_position=$2 local found_pkgs=( ./results/$HAB_ORIGIN-$pkg_name-*.hart ) local pkg_count=${#found_pkgs[@]} declare -A indexed_pkgs for i in ${!found_pkgs[@]}; do ((current_count=pkg_count-1-i)) if [ $current_count == 0 ] ; then head_offset="HEAD" else head_offset="HEAD~$current_count" fi indexed_pkgs+=([$head_offset]=${found_pkgs[$i]}) done local pkg_to_run=${indexed_pkgs[$pkg_position]} if [ -z "$pkg_to_run" ] ; then echo "Could not find a package at $pkg_position. There are $pkg_count total package(s)." return fi echo "Running $pkg_to_run" hab sup start $pkg_to_run }