Skip to content

Commit

Permalink
rename replace-cmt to replace-comment
Browse files Browse the repository at this point in the history
  • Loading branch information
thatportugueseguy committed Nov 26, 2024
1 parent 8f41ce3 commit f39c5e6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion bin/main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1007,7 +1007,7 @@ module Replace_comments = struct

let replace_comments =
let doc = "replaces the comments of the specified secret, keeping the secret." in
let info = Cmd.info "replace-cmt" ~doc in
let info = Cmd.info "replace-comment" ~doc in
let term = main_run Term.(const replace_comment $ Flags.secret_name) in
Cmd.v info term
end
Expand Down
16 changes: 8 additions & 8 deletions tests/replace_cmt_command.t → tests/replace_comment_command.t
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
$ . ./setup_fixtures.sh

Should fail - replace comments of a non-existing secret in a new folder - redirects to passage create or new
$ echo "comment" | passage replace-cmt folder/new
$ echo "comment" | passage replace-comment folder/new
E: No recipients found (use "passage {create,new} folder/new_secret_name" to use recipients associated with $PASSAGE_IDENTITY instead)
[1]

Should fail - replace comments of a non-existing secret
$ echo "comment" | passage replace-cmt 00/secret2
$ echo "comment" | passage replace-comment 00/secret2
E: no such secret: 00/secret2
[1]

Should succeed - replacing a the comments on a single-line secret without comments
$ echo "replaced comments" | passage replace-cmt 00/secret1
$ echo "replaced comments" | passage replace-comment 00/secret1
$ passage cat 00/secret1
(00/secret1) secret: single line

replaced comments

Should succeed - replacing a the comments on a single-line secret with comments
$ echo "replaced again comments" | passage replace-cmt 00/secret1
$ echo "replaced again comments" | passage replace-comment 00/secret1
$ passage cat 00/secret1
(00/secret1) secret: single line

replaced again comments

Should succeed - replacing single-line comments with multiline comments
$ echo "replaced again comments\nline 2" | passage replace-cmt 00/secret1
$ echo "replaced again comments\nline 2" | passage replace-comment 00/secret1
$ passage cat 00/secret1
(00/secret1) secret: single line

replaced again comments
line 2

Should succeed - replacing multiline comments with multiline comments
$ echo "new comments\nline 2 of said new comments" | passage replace-cmt 00/secret1
$ echo "new comments\nline 2 of said new comments" | passage replace-comment 00/secret1
$ passage cat 00/secret1
(00/secret1) secret: single line

Expand All @@ -42,7 +42,7 @@ Should succeed - replacing multiline comments with multiline comments

Should succeed - replacing multiline comments with multiline comments - in multiline secret
$ setup_multiline_secret_with_comments 00/secret2
$ echo "new comments\nline 2 of said new comments" | passage replace-cmt 00/secret2
$ echo "new comments\nline 2 of said new comments" | passage replace-comment 00/secret2
$ passage cat 00/secret2

new comments
Expand All @@ -52,7 +52,7 @@ Should succeed - replacing multiline comments with multiline comments - in multi
(00/secret2) secret: line 2

Should fail - comments with empty lines in the middle
$ echo "uno commento\n\ndos commentos" | passage replace-cmt 00/secret1
$ echo "uno commento\n\ndos commentos" | passage replace-comment 00/secret1
The comments are in an invalid format: secrets cannot have empty lines in the middle of the comments
[1]
$ passage cat 00/secret1
Expand Down

0 comments on commit f39c5e6

Please sign in to comment.