Compare commits

..
2 Commits
Author SHA1 Message Date
KKlochko df8f580f93 Fix writing to a file only when the option is set.
continuous-integration/drone/push Build is passing
2023-10-02 22:29:22 +03:00
KKlochko 871fc3ed55 Fix checking for file existence only when the options are set. 2023-10-02 22:26:32 +03:00
+6 -3
View File
@@ -69,10 +69,12 @@
(map-has-keys? options [:message, :message-file]) (map-has-keys? options [:message, :message-file])
{:exit-message (error-msg ["You can't use message and message-file options at the same time!!!"])} {:exit-message (error-msg ["You can't use message and message-file options at the same time!!!"])}
(file/is-file-not-exists? (:message-file options)) (and (contains? options :message-file)
(file/is-file-not-exists? (:message-file options)))
{:exit-message (error-msg ["Please, check the path to the message file!!!"])} {:exit-message (error-msg ["Please, check the path to the message file!!!"])}
(file/is-file-exists? (:output-file options)) (and (contains? options :output-file)
(file/is-file-exists? (:output-file options)))
{:exit-message (error-msg ["Please, choose another file!!! Overwriting was prevented!!!"])} {:exit-message (error-msg ["Please, choose another file!!! Overwriting was prevented!!!"])}
(and (map-has-keys? options [:cipher, :key]) (and (map-has-keys? options [:cipher, :key])
@@ -145,7 +147,8 @@
(defn show-and-save-output (defn show-and-save-output
"Print and save the output to a file if needed" "Print and save the output to a file if needed"
[output options] [output options]
(save-output output options) (when (contains? options :output-file)
(save-output output options))
(println output)) (println output))
(defn cracking-actions (defn cracking-actions