Browse Source

En cours de développement

master
mls-361 6 months ago
parent
commit
a72f71dab5
  1. 12
      internal/cmdline/cmdline.go

12
internal/cmdline/cmdline.go

@ -15,7 +15,9 @@ import (
"forge.chapril.org/mls-361/crypto"
)
func getCrypto(app *application.Application) (*crypto.Crypto, error) {
var _errArgs = errors.New("not enough or too many arguments")
func newCrypto(app *application.Application) (*crypto.Crypto, error) {
c := crypto.New()
key, ok := app.LookupEnv("KEY")
@ -29,12 +31,12 @@ func getCrypto(app *application.Application) (*crypto.Crypto, error) {
func decrypt(app *application.Application) error {
if len(os.Args) != 3 {
help(app)
return errors.New("not enough or too many arguments") //////////////////////////////////////////////////////////
return _errArgs
}
es := os.Args[2]
c, err := getCrypto(app)
c, err := newCrypto(app)
if err != nil {
return err
}
@ -52,12 +54,12 @@ func decrypt(app *application.Application) error {
func encrypt(app *application.Application) error {
if len(os.Args) != 3 {
help(app)
return errors.New("not enough or too many arguments") //////////////////////////////////////////////////////////
return _errArgs
}
ds := os.Args[2]
c, err := getCrypto(app)
c, err := newCrypto(app)
if err != nil {
return err
}

Loading…
Cancel
Save