Skip to content

Commit 4553d9e

Browse files
tar and lssec
1 parent 624225c commit 4553d9e

File tree

4 files changed

+25
-13
lines changed

4 files changed

+25
-13
lines changed

man

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
help : show this help
22
reload : reload shell in same terminal
33
c : clear
4+
45
tools : list tools and versions
56
whoami : whoami for all tools
6-
setsec : set secret.setsec foo "bar baz"
7+
8+
setsec : set secret. e.g. setsec foo "bar baz"
79
getsec : get secret. e.g. getsec foo
8-
tz : targz full dir. tz <name> <path>
9-
utz : extract targz dir. utz <file>
10+
lssec : list secrets.
11+
12+
tz : targz full dir. tz <pathToCompress> <outputfile>
13+
tz ./tools ./tools.tar.gz
14+
utz : extract targz dir. utz <fileToUncompress> <pathUncompressTo>
15+
utz ./tools.tar.gz ./tools
1016
all : show all commands

rc/alias.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ alias tools="dot_tool_versions"
99
alias whoami="dot_tool_whoami"
1010
alias setsec="dot_set_secret"
1111
alias getsec="dot_get_secret"
12+
alias lssec="dot_list_secrets"
1213
alias tz="dot_targz"
1314
alias utz="dot_untargz"
1415

rc/functions.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,12 @@ function dot_get_secret() {
7373
dot_ensure_key
7474
mkdir -p "${DOT_PRIV_PATH}/secrets"
7575
openssl rsautl -inkey "${DOT_KEY_PATH}" -decrypt < "${DOT_PRIV_PATH}/secrets/${1}.dat"
76+
}
77+
78+
function dot_list_secrets() {
79+
for entry in "${DOT_PRIV_PATH}/secrets"/*.dat
80+
do
81+
file=${entry##*/}
82+
echo ${file%.*}
83+
done
7684
}

rc/tar.sh

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11

2-
# $1 name
3-
# $2 path
2+
# $1 path to compress
3+
# $2 output targz file
44
function dot_targz() {
5-
# set -e
6-
local tgt="~/Packages/$1.tar.gz"
7-
mkdir -p ~/Packages
8-
pushd "${2}" > /dev/null
9-
tar -c -z -f "${tgt}" --strip-components=1 .
10-
echo "Created ${tgt}"
11-
popd > /dev/null
5+
tar -C $1 -czv -f $2 .
126
}
137

8+
# $1 file to uncompress
9+
# $2 path to uncompress to
10+
# will create the target path if it does not exist
1411
function dot_untargz() {
15-
tar xzf $1
12+
mkdir -p $2 && tar -C $2 -xzv -f $1
1613
}

0 commit comments

Comments
 (0)