Skip to content

Commit

Permalink
feat: add absolute path
Browse files Browse the repository at this point in the history
  • Loading branch information
WajahatAliAbid committed Sep 20, 2024
1 parent 6fb80ac commit 65be7e9
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions cmd/sendMessage.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,13 @@ func RunSendMessages(cmd *cobra.Command, args []string) {
os.Exit(1)
}

infos, err := parseFile(fileName)
filePath, err := filepath.Abs(fileName)
if err != nil {
logger.Printfln(pterm.Red(err.Error()))
os.Exit(1)
}

infos, err := parseFile(filePath)
if err != nil {
logger.Printfln(pterm.Red(err.Error()))
os.Exit(1)
Expand All @@ -140,7 +146,13 @@ func RunSendMessages(cmd *cobra.Command, args []string) {
os.Exit(1)
}

files, err := Find(directoryName, ".json")
dirPath, err := filepath.Abs(directoryName)
if err != nil {
logger.Printfln(pterm.Red(err.Error()))
os.Exit(1)
}

files, err := Find(dirPath, ".json")
if err != nil {
logger.Printfln(pterm.Red(err.Error()))
os.Exit(1)
Expand Down

0 comments on commit 65be7e9

Please sign in to comment.