File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed
Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import * as CryptoJS from 'crypto-js'
33
44import Logger from '../utilities/logger'
55
6- import Hash from './hash '
6+ import Utilities from '../utilities/utilities '
77
88export default class Crypto extends Command {
99 static ENCRYPTION = 'encryption'
@@ -25,7 +25,7 @@ export default class Crypto extends Command {
2525 async run ( ) {
2626 const { args, flags} = this . parse ( Crypto )
2727
28- args . string = Hash . getInputString ( this , flags , args ) //always add input to args
28+ args . string = Utilities . getInputString ( this , flags , args ) //always add input to args
2929 args . type = flags . encryption ? flags . encryption : flags . decryption //type like AES,DES
3030
3131 this . checkParameters ( flags , args )
Original file line number Diff line number Diff line change @@ -27,4 +27,16 @@ export default class Utilities {
2727 }
2828 }
2929
30+ public static getInputString ( thisRef : any , flags : any , args : any ) { //need to make it static so Crypto can use this
31+ // if -s or -f is not passed we will take it from args
32+ if ( flags . string ) //if -s given
33+ return flags . string
34+ else if ( flags . file ) {
35+ Logger . info ( thisRef , `reading file: ${ flags . file } ` )
36+ return Utilities . getStringFromFile ( thisRef , flags . file )
37+ } else
38+ return args . string
39+ }
40+
41+
3042}
You can’t perform that action at this time.
0 commit comments