Add support for local cache in the CLI

Open
#950 2 comments 2 reactions 1 assignee View on GitHub

Nobody has claimed this yet.

  • #1318 by @remyleone — closed without merging

Assessment

This issue has not been assessed yet.

Description

autocomplete enhancement priority:lowest

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.

scw --debug autocomplete complete zsh -- 5 scw baremetal server get
Dominant language
Go
Stars
997
Forks
172
Avg merge
1d 3h
Merged PRs (30d)
107

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from scaleway/scaleway-cli

All issues in scaleway/scaleway-cli

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.