Comments (12)
I very much like kubectl and not having actions as flags, have a look at https://kubernetes.io/docs/reference/kubectl/cheatsheet/#kubectl-context-and-configuration
asyncapi config get-contexts # display list of files in the context of the CLI
asyncapi config current-context # display the name of the file that is currently a context of the CLI
asyncapi config use-context myasyncapi
thoughts?
from cli.
I was thinking about the commands for setting the context and then also overriding it if the user wants. @derberg do let me know what you think about this -
To set, update and delete the context
asyncapi context --set <specPath | URL> set or update the context
asyncapi context --remove clear the context
To override the context or to use a temporary context we can have a --spec
flag which would be a root level option.
asyncapi --spec=file/path/or/url generate <template>
from cli.
except for setting and removing, user also needs a way to list all (to know which one to set) and to check what is the current.
the best would be to save the context file as .asyncapi
in the "home" of the user, so where all files like .npm
, .docker
, .bash_profile
and others. It is the best place because long term we need to make sure npm
is not needed to install the CLI and should check out possibilities to publish it on managers like brew
from cli.
use
will be only for using existing one,
set` will be for setting a new one (and automatically set as current). Makes sense?
ok, got it. 👍🏻
from cli.
@Souvikns I think it is about time. Just consider as small PRs as possible to make review and merge process easy, so not all commands at start.
also current --context
flag will need to be fixed as now it points to a file and not context name, we just need another --file
flag
from cli.
I very much like kubectl and not having actions as flags, have a look at https://kubernetes.io/docs/reference/kubectl/cheatsheet/#kubectl-context-and-configuration
asyncapi config get-contexts # display list of files in the context of the CLI asyncapi config current-context # display the name of the file that is currently a context of the CLI asyncapi config use-context myasyncapi
thoughts?
Yeah, this is better, it's clear to understand.
So instead of flags, we use commands like
asyncapi context set <path|URL>
asyncapi context remove
So if context
is a command then set
and remove
is an argument. Still, I guess we should have a flag if the user wants to override the context in any case.
One thing I would like to clarify, about saving the context. As we will be saving the <filePath | URL> of the spec file.
Most users will install CLI globally where they might have different projects that are using async API spec file for their development. If we have a single context then the user has to change/update the context every time he switches from one workspace to another. @derberg what do you think, we should do for this scenario.
- One thing we can do is to let users save context in key-value pair where they can switch easily.
- We save the context in a key-value pair from where the context set command was called. then the user doesn't have to update the context every time he opens a new folder.
from cli.
@derberg to sum up, how about these commands for the context.
asyncapi context set <context-name> <filePath | URL> | set context
asyncapi context current | get the current set context
asyncapi context list | list all the contexts
asyncapi context remove | remove the current set context
from cli.
if I want to switch from context A to B, would I use set
? or we probably need use
, right? this is how I have it in nvm
, I do nvm use <node version>
after listing what I have
from cli.
Yeah, use
makes much more sense, but if use is changing the set context should we have another command for creating a new context value to be saved in the .asyncapi
file, or use
command will update/create a new context accordingly
from cli.
use
will be only for using existing one, set
will be for setting a new one (and automatically set as current). Makes sense?
from cli.
@derberg shall I start working on this issue 😊.
from cli.
🎉 This issue has been resolved in version 0.2.0 🎉
The release is available on:
Your semantic-release bot 📦🚀
from cli.
Related Issues (20)
- Implement new UI/UX improvements in config command
- Implement new UI/UX improvements in convert command HOT 1
- Implement new UI/UX improvements in generate command HOT 1
- Implement new UI/UX improvements in optimize command HOT 3
- Implement new UI/UX improvements in start command HOT 11
- Implement new UI/UX improvements in validate command HOT 1
- [BUG] CLI installation takes a lot of time HOT 5
- Support for multiple versions of generator HOT 14
- [BUG] Command generate fromTemplate brakes with MODULE_NOT_FOUND HOT 4
- [BUG] File name is not captured while creating new asyncapi.yml from using new command HOT 2
- [FEATURE] Adding a progress bar for CLI Commands to show the progress status HOT 2
- [FEATURE] New command to publish the result generated by generate and model command. HOT 1
- [FEATURE] New Command to format the Asyncapi document HOT 2
- Replace request by node-fetch HOT 1
- [BUG] generate fromTemplate fails since 1.13.0 HOT 4
- [FEATURE] Improve storage of `.asyncapi-analytics` config file HOT 7
- [FEATURE] Support ignore feature of optimizer HOT 2
- [BUG] latest download URL is not working HOT 7
- [FEATURE] Add support to change the collection type for arrays in Java models HOT 1
- [TEST] Incomplete log of tests executed for `bundle` command HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cli.