Skip to content

Add support for local cache in the CLI #950

@remyleone

Description

@remyleone

As a CLI user, I want to autocomplete on the UUIDs, because I'm lazy to write/paste a UUID.

Expected behavior:

$ scw in
*tab tab*
$ scw instance
$ scw instance g
*tab tab*
$ scw instance get
$ scw instance get ser
*tab tab*
$ scw instance get server
*tab tab*
$ scw instance get server server-id=
$ scw instance get server server-id=a
*tab tab*
$ scw instance get server server-id=a863f248-dd4e-4445-ba66-afacbdcfac8d
*run*

Idea:
Having aAutoCompleteFunc and a ResolverFunc.

When trying to auto-complete a UUID field we should suggest a UUID or complete if only one match. In order to achieve this quickly, we should list the server IDs once and cache it somewhere. This catch must be updated on any create, update, list, or delete or after a cache TTL interval.

It also needs to not impact too much reactivity on auto-complete (avoiding unnecessary disk access on every completion).

This feature also needs to take into account the profile specified with the -p flag. We will get different resources with different profiles.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions