Skip to content

Commit

Permalink
Merge pull request #90 from allank-fd/feature/add-short-hand-cat-alias
Browse files Browse the repository at this point in the history
feat: Add shorthand cat alias c
  • Loading branch information
pimterry committed Apr 14, 2023
2 parents bf2c6ad + 71e522a commit 3eada25
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,7 @@ Renames a given note to destination or moves the note to directory. Name can be
Removes the given note if it exists. If `-r` or `--recursive` is given, deletes the folders/notes recursively.

### `notes cat <note-name>`

Displays the note
Displays the note. Shorthand alias also available with `notes c`.

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

Expand Down
4 changes: 2 additions & 2 deletions notes
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ Usage:
$name append|a <name> [message] # Appends a note. Will use stdin if no message is given
$name mv <source> <dest>|<directory> # Rename a note, or move a note when a directory is given
$name rm [-r | --recursive] <name> # Remove note, or folder if -r or --recursive is given
$name cat <name> # Display note
$name cat|c <name> # Display note
echo <name> | $name open|o # Open all note filenames piped in
echo <name> | $name cat # Display all note filenames piped in
$name --help # Print this usage information
Expand Down Expand Up @@ -358,7 +358,7 @@ main() {
cmd="remove_note"
modified=1
;;
"cat" )
"cat" | "c" )
cmd="handle_multiple_notes cat"
;;
--help | -help | -h )
Expand Down
9 changes: 9 additions & 0 deletions test/test-cat.bats
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ notes="./notes"
assert_output $'line1\nline2'
}

@test "Should show created note when using the cat shorthand alias" {
echo line1 >> "$NOTES_DIRECTORY/note.md"
echo line2 >> "$NOTES_DIRECTORY/note.md"
run $notes c note.md

assert_success
assert_output $'line1\nline2'
}

@test "Accepts names without .md to show" {
echo line1 >> "$NOTES_DIRECTORY/note.md"
echo line2 >> "$NOTES_DIRECTORY/note.md"
Expand Down

0 comments on commit 3eada25

Please sign in to comment.