Skip to content

Commit

Permalink
github actions trial
Browse files Browse the repository at this point in the history
  • Loading branch information
Amrit Singh committed Oct 1, 2024
1 parent c428e4b commit 47ab644
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
bin
passwords.txt
out/
out/
*.txt
6 changes: 3 additions & 3 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ var rootCmd = &cobra.Command{

// Execute adds all child commands to the root command and sets flags appropriately.
// This is called by main.main(). It only needs to happen once to the rootCmd.
func Execute() {
func Execute() error {
rootCmd.SetOutput(os.Stdout)

rootCmd.AddCommand(generateCmd)
// Execute the Cobra command tree, parsing args and identifying the command
if err := rootCmd.Execute(); err != nil {
os.Exit(1)
return err
}
os.Exit(0)
return nil
}
14 changes: 14 additions & 0 deletions cmd/root_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package cmd

import (
"testing"

"github.com/stretchr/testify/assert"
)

func TestExecute(t *testing.T) {
t.Run("The password cli tool must be runnable", func(t *testing.T) {
err := Execute()
assert.Nil(t, err)
})
}
11 changes: 9 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
package main

import "amritsingh183/password/cmd"
import (
"amritsingh183/password/cmd"
"os"
)

func main() {
cmd.Execute()
err := cmd.Execute()
if err != nil {
os.Exit(1)
}
os.Exit(0)
}

0 comments on commit 47ab644

Please sign in to comment.