aboutsummaryrefslogtreecommitdiffstats
path: root/src/cli/utils.cpp
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2019-04-26 09:29:45 -0400
committerJack Lloyd <[email protected]>2019-04-26 09:29:45 -0400
commit0952f06c252d1e2702f1944ac32821a36082ef7a (patch)
tree44407844833cb3b73844e3a9cb951ef13f7e2860 /src/cli/utils.cpp
parent4c65dc23c9966929dd0db465c0cb7c531a38d936 (diff)
Add a cmdlet to print UUIDs
Diffstat (limited to 'src/cli/utils.cpp')
-rw-r--r--src/cli/utils.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/cli/utils.cpp b/src/cli/utils.cpp
index 2de6b0ccb..52b14ff1c 100644
--- a/src/cli/utils.cpp
+++ b/src/cli/utils.cpp
@@ -17,6 +17,10 @@
#include <botan/http_util.h>
#endif
+#if defined(BOTAN_HAS_UUID)
+ #include <botan/uuid.h>
+#endif
+
namespace Botan_CLI {
class Print_Help final : public Command
@@ -249,6 +253,34 @@ class Print_Cpuid final : public Command
BOTAN_REGISTER_COMMAND("cpuid", Print_Cpuid);
+#if defined(BOTAN_HAS_UUID)
+
+class Print_UUID final : public Command
+ {
+ public:
+ Print_UUID() : Command("uuid") {}
+
+ std::string group() const override
+ {
+ return "misc";
+ }
+
+ std::string description() const override
+ {
+ return "Print a random UUID";
+ }
+
+ void go() override
+ {
+ Botan::UUID uuid(rng());
+ output() << uuid.to_string() << "\n";
+ }
+ };
+
+BOTAN_REGISTER_COMMAND("uuid", Print_UUID);
+
+#endif
+
#if defined(BOTAN_HAS_HTTP_UTIL)
class HTTP_Get final : public Command