-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a command for printing all available gola commands
- Loading branch information
1 parent
72eb014
commit a629293
Showing
4 changed files
with
35 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package commands | ||
|
||
import ( | ||
"github.com/spf13/cobra" | ||
|
||
"github.com/RashadAnsari/gola/internal/app/gola/config" | ||
"github.com/RashadAnsari/gola/internal/app/gola/log" | ||
) | ||
|
||
func main() { | ||
cfg, err := config.Init() | ||
if err != nil { | ||
log.Fatal("Failed to load configuration.") | ||
} | ||
|
||
for _, command := range cfg.Commands { | ||
log.Println(command.Name) | ||
} | ||
} | ||
|
||
// Register registers commands command for gola binary. | ||
func Register(root *cobra.Command) { | ||
root.AddCommand( | ||
&cobra.Command{ | ||
Use: "commands", | ||
Short: "Print all available gola commands", | ||
Run: func(_ *cobra.Command, args []string) { | ||
main() | ||
}, | ||
}, | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.