# Brief - A simple Java CLI (part 2)
## Prerequisite
- Fulfill "[A simple Java CLI (part 1)](https://hackmd.io/gazhPGlOSJiQpjJBE6TQsg)" brief
## Learning objectives
- Implement more complex logic
- Practice code refactoring
- Discover new classes from the Java library
- Learn about data structures and loops
- Learn about maintaining existing code
## How to?
- Same as part 1
## Commands to implement
Please note that some of the example outputs may vary from one computer to another.
### Logout (alias)
- Add a `logout` command which is an alias of the `exit` command. An alias, in this context, is an alternate name used to identify an existing command. In other words the behavior of the CLI is the same whether one types in `exit` or `logout`
- DRY: try not to repeat yourself (code duplication)
### Print (alias)
- Add a `print` command which is an alias of the `echo` command. An alias, in this context, is an alternate name used to identify an existing command. In other words the behavior of the CLI is the same whether one types in `echo` or `print`
- DRY: try not to repeat yourself (code duplication)
### Environment variables
- Update the existing `printenv` command so that the command prints all the environment variables when no argument is passed to the command. Each variable is printed on a separate line
- Arguments: none or one
- Example output (extract):
```shell
FPS_BROWSER_APP_PROFILE_STRING=Internet Explorer
LOGONSERVER=\\LAPTOP-0SV2FIHE
JAVA_HOME=C:\Program Files\Java\jdk-17.0.5+8
ALLUSERSPROFILE=C:\ProgramData
PROCESSOR_ARCHITECTURE=AMD64
...
```
### List directory content
- Add a `ls` command that prints the content (only names) of a directory. Each directory or file name is printed on a new line. If the path (argument) is not present or does not denote a directory the command prints `Not a directory`
- Arguments: a relative or absolute path to a directory
- Example output (command `ls C:\Program Files\Java\jdk-11.0.14.1+1`):
```shell
bin
conf
include
jmods
legal
lib
NOTICE
release
```
- Example output (command `ls ./`):
```shell
.classpath
.gitignore
.project
.settings
bin
src
```