containers / containers/toolbox

Nicer, more helpful CLI interaction

Open
#577 0 comments 1 reaction 0 assignees View on GitHub
2. CLI 2. Design 2. Host Realm 3. Enhancement Project Pickle 🥒
Dominant language
Go
Stars
3.5k
Forks
262
Avg merge
3d 1h
Merged PRs (30d)
1

Description

The current toolbox CLI feels a bit immature and like it would benefit from some refinement. From a UX perspective, there are occasions when it feels like it could be more helpful, particularly when it comes to recovering from errors. However, we could also do to look at language and formatting more generally, to make it easy to understand and read.

## Current design

Examples from the current CLI, along with comments on where it could be improved.

### Missing command

```
$ toolbox
Error: missing command

create Create a new toolbox container
enter Enter an existing toolbox container
list List all existing toolbox containers and images

Run 'toolbox --help' for usage.
$ ▮
```

Issues here: it's negative and somewhat accusatory, the list of commands could be easier to distinguish, it could provide some more useful information for the user.

### Incorrect toolbox name

```
$ toolbox enter fedora-toolbox-3
Error: container fedora-toolbox-3 not found
Use the '--container' option to select a toolbox.
Run 'toolbox --help' for usage.
$ ▮
```

This isn't very helpful. Also, the different parts of the message are lumped together and are hard to differentiate. Saying 'error' feels jarring and unnecessary.

### Toolbox create

```
$ toolbox create fedora-32-2
Created container: fedora-32-2
Enter with: toolbox enter fedora-32-2
$ ▮
```

The main thing here is formatting. (Do we have style guide for CLI? Seems like we should.) I would generally put instance names in quote marks, when they're part of a sentence.

I would also use indentation and line spaces to delineate different types of information.

## Suggested design

Some tentative suggestions for what the CLI could look like.

### Missing command

With no toolboxes:

```
$ toolbox
Common commands:
create Create a new toolbox container
enter Enter an existing toolbox container
list List all existing toolbox containers and images

See 'toolbox --help' for more information.

No toolboxes found.
$ ▮
```

With toolboxes:

```
$ toolbox
Common commands:
create Create a new toolbox container
enter Enter an existing toolbox container
list List all existing toolbox containers and images

See 'toolbox --help' for more information.

Available toolboxes:
fedora-toolbox-32
fedora-toolbox-33
$ ▮
```

### Incorrect toolbox name

Single toolbox present:

```
$ toolbox enter fedor-toolbo-32
'fedor-toolbo-32' not found.

Enter 'fedora-toolbox-32'? [Y/n]: ▮
```

The nice thing about this is that it's a single key stroke to recover from the error.

Multiple toolboxes present:

```
$ toolbox enter fedor-toolbo-32
Toolbox 'fedor-toolbo-32' not found.

Available toolboxes:
1. fedora-toolbox-32
2. fedora-toolbox-33

Enter number to enter (0 to cancel): ▮
```

### Toolbox create

```
$ toolbox create fedora-32-2
Created 'fedora-32-2'. To enter, run:
toolbox enter fedora-32-2
$ ▮
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.