

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Still calibrating
click for more info
Not enough gems
Cost: 6 gems
1: Welcome to the Blog Aggregator
incomplete
2: Config
incomplete
3: Commands
incomplete
This lesson's interactive features are locked, please to keep using them
Gator is a CLI application, and like many CLI applications, it has a set of valid commands. For example:
gator login - sets the current user in the configgator register - adds a new user to the databasegator users - lists all the users in the databaseWe'll be hand-rolling our CLI rather than using a framework like Cobra or Bubble Tea. This will give us a better understanding of how CLI applications work.
Let's start with a simple login command. For now, all it will do is set the current user in the config file. Usage:
gator login <username>
We want to add many commands to our CLI, so let's build a flexible system that will allow us to register new commands easily.
If there are fewer than 2 arguments, print an error message to the terminal and exit. Why two? The first argument is automatically the program name, which we ignore, and we require a command name.
Run and submit the CLI tests from the root of your project.