Polyglot Programming

Learn C#, Python, and Go through practical examples

List command

Implement the list command

go python

Exercise

The last command to implement is the list command. This command should display all the environment variables stored in the database for a given directory. If no directory is provided, it will display a list of all stored directories.

list

Lists stored directories or environment variables.

envtamer list [DIRECTORY_NAME]

  • DIRECTORY_NAME: Optional. The directory to list env variables for.

If no directory is specified, this command lists all directories stored in the database. If a directory is provided, it lists all environment variables stored for that directory.

Go

We will need to implement the last function on the storage class, the listDirectories function. We should be able to implement it without any new packages or functions.

Python

We will need to implement the last command list_command.py. We should be able to implement it without any new packages or functions.

the final file structure should look like this:

├── envtamer
│   └── __init__.py
│   ├── cli.py
│   └── file_handler.py
│   └── init_command.py
│   └── list_command.py
│   └── pull_command.py
│   └── push_command.py
├── envtamer_db
│   └── __init__.py
│   ├── env_variable.py
│   └── envtamer_db.py
├── tests
│   └── __init__.py
├── poetry.lock
├── pyproject.toml
└── README.md

Solution

Solution
git clone --branch 07-list-command --single-branch https://github.com/XPRTZ/envtamer.git