Skip to content

Commit efac038

Browse files
committed
[REFACTOR]: input string always stored in args
Signed-off-by: ashish <[email protected]>
1 parent d6d573c commit efac038

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/commands/hash.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,16 @@ export default class Hash extends Command {
2424

2525
// only 2 parameters required HASH_TYPE and INPUT_STRING
2626
flags.type = Hash.getHashType(flags) //by default let it be sha1
27-
flags.string = Hash.getInputString(flags,args) // from either -s,-f or args
27+
args.string = Hash.getInputString(flags,args) // from either -s,-f or args
2828

29-
this.calculateHash(flags)
29+
this.calculateHash(flags, args)
3030
}
3131

32-
private calculateHash(flags: any) {
32+
private calculateHash(flags: any, args:any) {
3333
const hashObject = Hash.getHashObject(flags)
3434

3535
if (hashObject) {
36-
let hashed: string = hashObject.hex(flags.string)
36+
let hashed: string = hashObject.hex(args.string)
3737
Logger.success(this, `[${flags.type.toUpperCase()}] ${hashed}`)
3838
} else {
3939
Logger.error(this, 'Invalid Or Unsupported hash type')
@@ -61,7 +61,7 @@ export default class Hash extends Command {
6161
return flags.type || 'sha1'
6262
}
6363

64-
private static getInputString(flags: any, args:any) {
64+
static getInputString(flags: any, args:any) {
6565
// if -s or -f is not passed we will take it from args
6666
let str=''
6767
if (flags.string) //if -s given

0 commit comments

Comments
 (0)