Skip to content

A peer-to-peer stack for code collaboration

Rename rad-create-keys to rad-key (#503)

Merle Breitkreuzc37fc5b5dead
diff --git a/bin/rad-create-keys b/bin/rad-key
similarity index 58%
rename from bin/rad-create-keys
rename to bin/rad-key
index 7fa0a3b..af873dc 100755
--- a/bin/rad-create-keys
+++ b/bin/rad-key
@@ -5,14 +5,14 @@
(import prelude/key-management :as 'key-mgmt)
(def help
- "rad create-keys - Radicle Key Management CLI
+ "rad key - Radicle Key Management CLI
Usage:
- rad create-keys [--force]
- rad create-keys help
+ rad key create [--force]
+ rad key help
- Create a new key pair with `rad create-keys`. If `--force` is appended, an
- existing key pair file will be overwritten.
+ Creates a new key pair. If `--force` is appended, an existing key pair
+ file will be overwritten.
Per default, key pairs are stored in `$HOME/.config/radicle/my-keys.rad`
this can be adjusted by setting `$XDG_CONFIG_HOME`.
@@ -31,10 +31,18 @@
(match (key-mgmt/read-keys!)
:nothing (make-keys)
_ (put-str! "The `my-keys.rad` file already exists.
-If you are sure that you want to replace your key pair, run `rad-create-keys --force`"))))
+If you are sure that you want to replace your key pair, run `rad key create --force`"))))
+
+(def cmd-parse-failure
+ (fn [error]
+ (parse-failure error help)))
(def args (get-args!))
(match args
- ["--force"] (make-keys)
- [] (safe-make-keys)
- _ (put-str! help))
+ ["create" "--force"] (make-keys)
+ (/cmd-0 "create" help) (safe-make-keys)
+ ["help"] (put-str! help)
+ ["-h"] (put-str! help)
+ ["--help"] (put-str! help)
+ (/cons 'cmd _) (cmd-parse-failure (string-append "Unknown command: " cmd))
+ _ (put-str! help))
diff --git a/rad/prelude/error-messages.rad b/rad/prelude/error-messages.rad
index 84f9eab..61d288a 100644
--- a/rad/prelude/error-messages.rad
+++ b/rad/prelude/error-messages.rad
@@ -268,8 +268,8 @@ This may be because you have no internet connection, you are not authorized to p
(fn []
(string-append
"Missing file: my-keys.rad\n"
- "Do `rad create-keys` to create your own key pair and rerun your command.")))
+ "Do `rad key create` to create your own key pair and rerun your command.")))
(:test "missing-key-file"
[(missing-key-file) ==> "Missing file: my-keys.rad
-Do `rad create-keys` to create your own key pair and rerun your command."])
+Do `rad key create` to create your own key pair and rerun your command."])
diff --git a/test/e2e/DiffAppTest.hs b/test/e2e/DiffAppTest.hs
index ce714c7..b8db35d 100644
--- a/test/e2e/DiffAppTest.hs
+++ b/test/e2e/DiffAppTest.hs
@@ -10,7 +10,7 @@ import Test.E2ESupport
test_diff_propose :: TestTree
test_diff_propose = testCaseSteps "diff propose" $ \step -> do
step "Init project"
- _ <- runTestCommand "rad-create-keys" []
+ _ <- runTestCommand "rad-key" ["create"]
_ <- runTestCommand "git" ["config", "--global", "user.name", "Alice"]
_ <- runTestCommand "git" ["config", "--global", "user.email", "[email protected]"]
_ <- runTestCommand' "rad-project" ["init"] ["project-name", "project desc", "1"]