diff --git a/src/cipher_analytical_machine/cli/cli.clj b/src/cipher_analytical_machine/cli/cli.clj index ab2ac09..e2dd527 100644 --- a/src/cipher_analytical_machine/cli/cli.clj +++ b/src/cipher_analytical_machine/cli/cli.clj @@ -1,5 +1,7 @@ (ns cipher-analytical-machine.cli.cli (:require + [cipher-analytical-machine.parsers.parsers :as ps] + [cipher-analytical-machine.parsers.gamma :as gamma-ps] [cipher-analytical-machine.cli.file :as file] [cipher-analytical-machine.symbols.factories :as sf] [cipher-analytical-machine.cli.options :as options] @@ -77,6 +79,15 @@ (or (contains? options :encrypt) (contains? options :decrypt))) (cond + (and (= (:cipher options) "Caesar") + (false? (ps/int-string? (:key options)))) + {:exit-message (error-msg ["Please, use the key format: [+-](integer)!!! Example: 10, +9, -7."])} + + (and (= (:cipher options) "Gamma") + (false? (gamma-ps/key? (:key options)))) + {:exit-message (error-msg ["Please, use the key format: [+-](integer),[+-](integer),[+-](integer) !!! Example: 10,+9,-7."])} + + (contains? options :encrypt) {:options options :arguments arguments :action-type :encrypt}