How to write beautiful Golang CLI
The definitive guide to building Golang based CLI, full tutorial with example code.
If you want to build rock-solid, extensible CLI that multiple teams can contribute to – look no further. In this video we go from theory to implementation – show you how I’ve built a successful CLI that hundreds of engineers have used.
Source code if you are interested, is also available here:
– https://github.com/cloud-native-skunkworks/toolbox-cli-example
– https://github.com/AlexsJones/cli
Timecodes:
0:00 Introduction
1:08 Multi-contributor CLI
2:05 Cobra
3:22 Cobra-CLI
4:49 Ready to build!
5:50 Structuring for extensibility
7:59 Moving new commands
8:28 Here is the trick…
10:55 Mistakes are good
12:42 Structured subcommand
18:06 Building some functionality
21:15 First working command
22:37 Disk usage command
25:21 Recap
25:43 Viper configuration
26:32 Implementing viper in an existing project
29:24 Conclusion
Comments are closed.