diff options
-rw-r--r-- | cdlog.sh | 18 |
1 files changed, 15 insertions, 3 deletions
@@ -84,14 +84,19 @@ cdlog.init() if [ $# -gt 0 -a $1 != ~/.cdlog.'*'.dirs ] ; then printf "These cdlog contexts exist:\n" - i=1 + i=0 for dir in "$@"; do - printf "[%d]: %s\n" $((i++)) "$(date -r "$dir")" + printf "[%d]: %s\n" $((++i)) "$(date -r "$dir")" sed -e '/^$/d' "$dir" done while true; do - printf "Make a selection or press Enter for new context: " + if [ $i -eq 1 ] ; then + printf "Use 1 to select context, c1 to clone,\n" + else + printf "Use 1-%s to select context, c1-c%s to clone,\n" $i $i + fi + printf "or Enter for new blank ontext: " read sel case $sel in ( [1-9] ) @@ -101,6 +106,13 @@ cdlog.init() break fi ;; + ( c[1-9] ) + sel=$(cdlog.get_param ${sel#c} "$@") + if [ -n "$sel" ] ; then + cp "$sel" "$cdlog_dirs" + break + fi + ;; ( "" ) break ;; |