yorkie-team/yorkie

Simplify CLI commands by saving rpc-addr and project to context

hackerwins opened this issue · 2 comments

Description:

Simplify CLI commands by saving rpc-addr and project to context

Currently, we need to pass the rpc-addr and project for every command.
For example to list documents:

$ yorkie document ls default --rpc-addr localhost:11101

We can simplify commands using the config command:

// save the context of `localhost:11101` to `~/.yorkie/config.json`
$ yorkie login -u admin -p admin --insecure localhost:11101
$ yorkie document ls codepair

// save the context of api.yorkie.dev to `~/.yorkie/config.json`
$ yorkie login -u admin -p admin api.yorkie.dev:443
$ yorkie document ls whiteboard

// list the contexts from `~/.yorkie/config.json`
$ yorkie context ls

// switch the context to `localhost:11101`
$ yorkie context set localhost:11101

// delete the current context from `~/.yorkie/config.json`
$ yorkie logout

Refer to https://kubernetes.io/docs/reference/kubectl/cheatsheet/#kubectl-context-and-configuration

Why:

Wu22e commented

I'm interested in this issue. Can I work on it?

@Wu22e Of course. If you have any questions, feel free to ask.