@@ -2,6 +2,7 @@ package cmd
2
2
3
3
import (
4
4
"encoding/json"
5
+ "fmt"
5
6
"log"
6
7
"os"
7
8
"strings"
15
16
)
16
17
17
18
// textToJsonCmd represents the aa command
18
- var keyValueToJson = & cobra.Command {
19
+ var keyValueToJsonCmd = & cobra.Command {
19
20
Use : "KVTJ [flags]" ,
20
21
Short : "Converts Key-Value (text) to JSON." ,
21
22
Run : func (cmd * cobra.Command , args []string ) {
@@ -88,16 +89,18 @@ var keyValueToJson = &cobra.Command{
88
89
89
90
_ , err = file .WriteString (string (jsonString ))
90
91
checkNilErr (err )
92
+
93
+ fmt .Println ("Operation completed successfully. Check the" , outputJsonFile1 , "file." )
91
94
},
92
95
}
93
96
94
97
func init () {
95
98
96
99
// Flags for the TTJ command
97
- keyValueToJson .Flags ().StringVarP (& inputTextFile , "file" , "f" , "" , "Input the text file name. Eg: keys.txt or .env" )
98
- err := keyValueToJson .MarkFlagRequired ("file" )
100
+ keyValueToJsonCmd .Flags ().StringVarP (& inputTextFile , "file" , "f" , "" , "Input the text file name. Eg: keys.txt or .env" )
101
+ err := keyValueToJsonCmd .MarkFlagRequired ("file" )
99
102
checkNilErr (err )
100
103
101
- keyValueToJson .Flags ().StringVarP (& outputJsonFile1 , "output" , "o" , "" , "Output JSON file name (default is output.json)" )
102
- keyValueToJson .Flags ().BoolP ("print" , "p" , false , "Print the output to the console" )
104
+ keyValueToJsonCmd .Flags ().StringVarP (& outputJsonFile1 , "output" , "o" , "" , "Output JSON file name (default is output.json)" )
105
+ keyValueToJsonCmd .Flags ().BoolP ("print" , "p" , false , "Print the output to the console" )
103
106
}
0 commit comments