Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always follow the same structure (verb + noun, noun + verb, or namespace + verb + noun) #37

Closed
fmvilas opened this issue Jul 26, 2021 · 15 comments
Labels
bug Something isn't working

Comments

@fmvilas
Copy link
Member

fmvilas commented Jul 26, 2021

I think we should be following a structure, regardless of the command at hand. For instance:

asyncapi validate file

Is following the verb + noun approach. Whereas:

asyncapi context add

Is reversing it to noun + verb.

In #1, I suggested we use verb + noun because it reads naturally. However, after thinking about how to flip contexts and how to occasionally evolve them to accept multiple asyncapi files, it seems the noun + verb might work better here. Just like the Github CLI. So for instance, if I want to add one more asyncapi file to a context, how would it be?

asyncapi add context # that sounds like adding a context not "adding to" a context
asyncapi add-to context # clear but ugly

So maybe it's a better idea to go for something like:

asyncapi context add # Creates a context
asyncapi context add file # Adds a file to a context

In this case, the structure would be something like noun + verb + [noun] (being the last noun optional). To avoid confusion, I suggest we call it namespace + verb + [noun] because the first noun actually works like a namespace.

@fmvilas fmvilas added the bug Something isn't working label Jul 26, 2021
@derberg
Copy link
Member

derberg commented Jul 27, 2021

I suggested asyncapi context add and others as it feels very natural when I use the same approach with GitHub CLI. I just think the verbs might be very different per noun, so verb + noun would be very strange here.

the problem is that sometimes there is just no noun, like validate or generate, so general rule sound like noun? + verb

@fmvilas
Copy link
Member Author

fmvilas commented Aug 4, 2021

Yeah, that's true. Maybe we should still consider the namespace and make it something like [namespace] + verb + [noun]? Just throwing ideas.

@derberg
Copy link
Member

derberg commented Aug 5, 2021

I have to say I'm not fully getting the namespace idea. What would it be?

@fmvilas
Copy link
Member Author

fmvilas commented Aug 5, 2021

Like in this case:

asyncapi context add file

It's different than:

asyncapi context add

The first one adds an AsyncAPI file to the context, the second one adds a context. The first one is, for instance, if we want to have tools like https://github.com/asyncapi/app-relations-discovery in the CLI. In that case, you don't want to manually specify all the files because they could potentially be hundreds. Does it make sense?

@derberg
Copy link
Member

derberg commented Aug 17, 2021

I case kubectl or github cli, stuff similar to context, go under config verb actually so it is either kubectl config get-context or gh config set editor vim. I think we should follow, as in our case context is pure config related, having it on the "root" may confuse it has anything to do with the AsyncAPI-related functionalities

We need asyncapi + verb no matter of above 😄 as context would go under config, config can be verb or noun 😄 we win as validate is verb 🤷🏼

@fmvilas
Copy link
Member Author

fmvilas commented Aug 19, 2021

So what would be an example? Something like:

# To add a context
asyncapi config context add
# To add a file to a context
asyncapi config context add file

Is it what you mean?

@derberg
Copy link
Member

derberg commented Aug 23, 2021

would be asyncapi config context add {CONTEXT_NAME} {FILE_PATH}, now it is asyncapi context add {CONTEXT_NAME} {FILE_PATH}. To follow asyncapi + verb in case of app-replations-finder aka cupid we would need asyncapi find-relations or something similar, asyncapi relate?

@Souvikns
Copy link
Member

Just as @fmvilas said context is not a verb so asyncapi context add is breaking the (verb + noun) rule and everything else is following it. Could we name the context commands something like this

asyncapi add-context <context-name> <path>
asynapi list-context 
asyncapi use-context  <context-name>

It kind of follows the (verb + noun ) rule. What do you think ? @fmvilas @derberg

@derberg
Copy link
Member

derberg commented Aug 30, 2021

@Souvikns I proposed asyncapi config context add instead of asyncapi add-context as I'm simply afraid of those hyphened commands 😄 It is like this with kubectl probably also to satisfy some main rule, but not very intuitive. This is why I'm more into having config verb there. Config will not only be for context. For future, where we add more functionality, like asyncapi edit channel mychannel and open and editor like nano or vim, we will need some stuff under config to configure these editors

@Souvikns
Copy link
Member

Will open a PR for this just to summarize the task,

  • Will be removing the file flag option and adding support for input, though context will be passed through the --context flag.
  • Will be moving the context command in the config namespace.

@derberg
Copy link
Member

derberg commented Aug 30, 2021

please split it into 2 PRs, one for moving context into config. Then another one about removing file and context flag, as I thought we agreed that technically we can remove the context flag too, right?

@derberg
Copy link
Member

derberg commented Sep 7, 2021

so, we have an agreement here, right?

@github-actions
Copy link
Contributor

github-actions bot commented Jan 6, 2022

This issue has been automatically marked as stale because it has not had recent activity 😴

It will be closed in 120 days if no further activity occurs. To unstale this issue, add a comment with a detailed explanation.

There can be many reasons why some specific issue has no activity. The most probable cause is lack of time, not lack of interest. AsyncAPI Initiative is a Linux Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model.

Let us figure out together how to push this issue forward. Connect with us through one of many communication channels we established here.

Thank you for your patience ❤️

@github-actions github-actions bot added the stale label Jan 6, 2022
@fmvilas
Copy link
Member Author

fmvilas commented Jan 7, 2022

so, we have an agreement here, right?

I'd say so. We probably have to document it somewhere in the repo. WDYT?

@github-actions github-actions bot removed the stale label Jan 8, 2022
@derberg
Copy link
Member

derberg commented Jan 12, 2022

I think what we have here is enough -> https://github.com/asyncapi/cli#command-structure-and-patterns

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants