Home >Backend Development >Golang >Day ??? of learning go. Building cli apps
I have always had a preference for command line interface (CLI) and terminal user interface (TUI) tools over their graphical user interface (GUI) counterparts. This project, aptly named "Phraser" (no apologies for the poor naming), is a command line application designed to manage wallet seed phrases for crypto wallets. I developed this application to create a more convenient way to manage the seed phrases for my crypto wallets.
It creates a directory and stores the phrases in encrypted JSON files. You can then move the JSON files and store them anywhere you want.
To enhance my skills, I chose to rewrite a project I had previously written in Python using Go. Unlike the Python version, which requires a multitude of dependencies to be installed, the Go version can be compiled into a single binary, making it more portable and less cumbersome. Additionally, Go is known for its blazing speed(I couldn't resist:))
You can find a precompiled binary on the releases page of the GitHub repository(link at end of article).
If you prefer, you can clone the repository and install the dependencies to test it out.
The instructions are in the Readme in the GitHub repository, but I will still highlight them here.
Phraser is easy to use with a set of straightforward commands. Here's a basic overview:
phraser [command] [flags]
-a, --amount int amount of phrases to be inputted -h, --help help for phraser -s, --store string name of the store to access -t, --toggle Help message for toggle -w, --wallet string name of the wallet to be created
phraser init --store myStore
phraser create --store myStore --wallet myWallet --amount 12
phraser get --store --wallet myWallet
This project taught me a lot about Go-like encryption/decryption, file handling, and also the cobra-cli for building CLI apps. Any feedback and corrections are appreciated.
The source code can be found here
The above is the detailed content of Day ??? of learning go. Building cli apps. For more information, please follow other related articles on the PHP Chinese website!