diff --git a/README.md b/README.md index 10844f0..5955631 100644 --- a/README.md +++ b/README.md @@ -46,13 +46,14 @@ in your .zshrc. This requires antigen installed. 0. `cheat`, show cheat sheet for commands using cheat.sh (`cheat commandname`) 1. Quickly edit/reload profile (`esource`/`resource`) -2. `ramdisk` (only on OSX) create a RAM disk. Default size: 1GB +2. `dockertags` list all tags for a given docker image +3. `ramdisk` (only on OSX) create a RAM disk. Default size: 1GB ` ramdisk 4` creates a 4GB RAM disk -3. `color` to print colored text (see 3. in the Misc section): +4. `color` to print colored text (see 3. in the Misc section): color $Red "This will be printed in red" color $Yellow "This will be printed in red" -4. `mecp` to copy files back to the machine from wich you are ssh-ing. +5. `mecp` to copy files back to the machine from wich you are ssh-ing. For this to work an ssh tunnel with Remoteforward is needed: ssh -R 22:localhost:2222 YOURHOSTNAMEHERE or specify this in ~/.ssh/config: diff --git a/functions.sh b/functions.sh index 9833f0a..a42fd9f 100755 --- a/functions.sh +++ b/functions.sh @@ -17,6 +17,21 @@ function cheatall { curl "https://cheat.sh/~$1" } + +# List all docker tags for an image +function dockertags +{ + if [[ -z `which jq` ]]; then + echo "jq not installed. Please install jq." 1>&2 + return + fi + i=0 + while [[ $? == 0 ]]; do + i=$(($i+1)) + curl "https://registry.hub.docker.com/v2/repositories/library/$1/tags/?page=$i" 2>/dev/null | jq '."results"[]["name"]' + done +} + ## Simple calculator. Usage: calc 1+1, calc 5/7, calc "sqrt(2)" function calc {