Skip to content

Commit 1dea020

Browse files
committed
Use PWD when scd --add has no arguments.
Make it consistent with the operation of `scd --unindex`.
1 parent 4054a5c commit 1dea020

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ scd [options] [pattern1 pattern2 ...]
2222

2323
<dl><dt>
2424
-a, --add</dt><dd>
25-
add specified directories to the directory index.</dd><dt>
25+
add current or specified directories to the directory index.</dd><dt>
2626

2727
--unindex</dt><dd>
2828
remove current or specified directories from the index.</dd><dt>

bin/scd

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ recent or frequently visited directories as found in the directory index.
1515
Display a selection menu in case of multiple matches.
1616
1717
Options:
18-
-a, --add add specified directories to the directory index.
18+
-a, --add add current or specified directories to the index.
1919
--unindex remove current or specified directories from the index.
2020
-r, --recursive apply options --add or --unindex recursively.
2121
--alias=ALIAS create alias for the current or specified directory and
@@ -197,7 +197,7 @@ _scd_Y19oug_record() {
197197
}
198198

199199
if [[ -n $opt_add ]]; then
200-
m=( ${^argv}(N-/) )
200+
m=( ${^${argv:-$PWD}}(N-/) )
201201
_scd_Y19oug_abspath m ${m}
202202
_scd_Y19oug_record $m
203203
if [[ -n $opt_recursive ]]; then
@@ -215,6 +215,7 @@ if [[ -n $opt_unindex ]]; then
215215
if [[ ! -s $SCD_HISTFILE ]]; then
216216
$EXIT
217217
fi
218+
argv=( ${argv:-$PWD} )
218219
# expand existing directories in the argument list
219220
for i in {1..$#}; do
220221
if [[ -d ${argv[i]} ]]; then
@@ -239,7 +240,7 @@ if [[ -n $opt_unindex ]]; then
239240
}
240241
}
241242
{ print $0 }
242-
' $SCD_HISTFILE ${*:-$PWD} )" || $EXIT $?
243+
' $SCD_HISTFILE $* )" || $EXIT $?
243244
: >| ${SCD_HISTFILE}
244245
[[ ${#m} == 0 ]] || print -r -- $m >> ${SCD_HISTFILE}
245246
$EXIT

ipython/ipy_scd.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def do_scd(self, arg):
7979
Display a selection menu in case of multiple matches.
8080
8181
Options:
82-
-a, --add add specified directories to the directory index.
82+
-a, --add add current or specified directories to the index.
8383
--unindex remove current or specified directories from the index.
8484
-r, --recursive apply options --add or --unindex recursively.
8585
--alias=ALIAS create alias for the current or specified directory and

0 commit comments

Comments
 (0)