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'
3
3
4
4
import Logger from '../utilities/logger'
5
5
6
- import Hash from './hash '
6
+ import Utilities from '../utilities/utilities '
7
7
8
8
export default class Crypto extends Command {
9
9
static ENCRYPTION = 'encryption'
@@ -25,7 +25,7 @@ export default class Crypto extends Command {
25
25
async run ( ) {
26
26
const { args, flags} = this . parse ( Crypto )
27
27
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
29
29
args . type = flags . encryption ? flags . encryption : flags . decryption //type like AES,DES
30
30
31
31
this . checkParameters ( flags , args )
Original file line number Diff line number Diff line change @@ -27,4 +27,16 @@ export default class Utilities {
27
27
}
28
28
}
29
29
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
+
30
42
}
You can’t perform that action at this time.
0 commit comments