|
|
@ -1,5 +1,7 @@
|
|
|
|
(ns cipher-analytical-machine.cli.cli
|
|
|
|
(ns cipher-analytical-machine.cli.cli
|
|
|
|
(:require
|
|
|
|
(: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.cli.file :as file]
|
|
|
|
[cipher-analytical-machine.symbols.factories :as sf]
|
|
|
|
[cipher-analytical-machine.symbols.factories :as sf]
|
|
|
|
[cipher-analytical-machine.cli.options :as options]
|
|
|
|
[cipher-analytical-machine.cli.options :as options]
|
|
|
@ -77,6 +79,15 @@
|
|
|
|
(or (contains? options :encrypt)
|
|
|
|
(or (contains? options :encrypt)
|
|
|
|
(contains? options :decrypt)))
|
|
|
|
(contains? options :decrypt)))
|
|
|
|
(cond
|
|
|
|
(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)
|
|
|
|
(contains? options :encrypt)
|
|
|
|
{:options options :arguments arguments :action-type :encrypt}
|
|
|
|
{:options options :arguments arguments :action-type :encrypt}
|
|
|
|
|
|
|
|
|
|
|
|