Skip to content

Commit 3eada25

Browse files
committed
Merge pull request #90 from allank-fd/feature/add-short-hand-cat-alias
feat: Add shorthand cat alias c
2 parents bf2c6ad + 71e522a commit 3eada25

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

README.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,7 @@ Renames a given note to destination or moves the note to directory. Name can be
147147
Removes the given note if it exists. If `-r` or `--recursive` is given, deletes the folders/notes recursively.
148148

149149
### `notes cat <note-name>`
150-
151-
Displays the note
150+
Displays the note. Shorthand alias also available with `notes c`.
152151

153152
### `notes grep/find <pattern> | notes open`
154153

notes

+2-2
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ Usage:
294294
$name append|a <name> [message] # Appends a note. Will use stdin if no message is given
295295
$name mv <source> <dest>|<directory> # Rename a note, or move a note when a directory is given
296296
$name rm [-r | --recursive] <name> # Remove note, or folder if -r or --recursive is given
297-
$name cat <name> # Display note
297+
$name cat|c <name> # Display note
298298
echo <name> | $name open|o # Open all note filenames piped in
299299
echo <name> | $name cat # Display all note filenames piped in
300300
$name --help # Print this usage information
@@ -358,7 +358,7 @@ main() {
358358
cmd="remove_note"
359359
modified=1
360360
;;
361-
"cat" )
361+
"cat" | "c" )
362362
cmd="handle_multiple_notes cat"
363363
;;
364364
--help | -help | -h )

test/test-cat.bats

100755100644
+9
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,15 @@ notes="./notes"
2121
assert_output $'line1\nline2'
2222
}
2323

24+
@test "Should show created note when using the cat shorthand alias" {
25+
echo line1 >> "$NOTES_DIRECTORY/note.md"
26+
echo line2 >> "$NOTES_DIRECTORY/note.md"
27+
run $notes c note.md
28+
29+
assert_success
30+
assert_output $'line1\nline2'
31+
}
32+
2433
@test "Accepts names without .md to show" {
2534
echo line1 >> "$NOTES_DIRECTORY/note.md"
2635
echo line2 >> "$NOTES_DIRECTORY/note.md"

0 commit comments

Comments
 (0)