Skip to content

Add note about different commands within and outside of app #51

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

Open
cllns opened this issue Sep 21, 2022 · 6 comments
Open

Add note about different commands within and outside of app #51

cllns opened this issue Sep 21, 2022 · 6 comments

Comments

@cllns
Copy link
Member

cllns commented Sep 21, 2022

We only allow hanami new outside of existing Hanami projects, and only allow almost all the other commands inside a Hanami 2 project (version is rightfully allowed in both).

For example:

% hanami version
v2.0.0.beta3
% hanami help
Commands:
  hanami new APP
  hanami version
% hanami new beta_three
% cd beta_three
% hanami help
Commands:
  hanami console                              # App REPL
  hanami generate [SUBCOMMAND]
  hanami install
  hanami middlewares                          # List all the registered middlewares
  hanami routes                               # Inspect application
  hanami server
  hanami version

Something like: "There are more commands available when you're inside of an app, but we've detected that you're not in a Hanami 2 folder". We could even list them (on one line, without descriptions) too. And when inside an app something like "hanami new is also available when you're outside of an existing Hanami project folder."

I think this could be a "good first issue" for newcomers who'd like to contribute to the Hanami 2 effort.

@jodosha
Copy link
Member

jodosha commented Sep 23, 2022

@cllns

Something like: ...

What do you mean? To print a warning message?

@cllns
Copy link
Member Author

cllns commented Sep 23, 2022

Yes, sorry that wasn't clear. The command behave differently in different context, so we should let the users know which context they're in. Otherwise I expect people may think "Huh? I don't see a hanami generate command, it must not have generators" when they first install the gem.

@jodosha
Copy link
Member

jodosha commented Dec 2, 2022

@cllns Sorry for asking the question again: do you want a warning message?
Isn't warning a signal of something wrong that the user did? Why we should warn on default usage?

@cllns
Copy link
Member Author

cllns commented Dec 2, 2022

No, not a warning. For example, when outside of an existing Hanami folder:

% hanami help
Commands:
  hanami new APP
  hanami version

Other commands available within a Hanami app:
  hanami console                              # App REPL
  hanami generate [SUBCOMMAND]
  hanami install
  hanami middlewares                          # List all the registered middlewares
  hanami routes                               # Inspect application
  hanami server

@jodosha
Copy link
Member

jodosha commented Dec 3, 2022

This isn't possible.

We register at the runtime two different command registries.

@cllns
Copy link
Member Author

cllns commented Dec 3, 2022

Gotcha. What about something generic like

% hanami help
Commands:
  hanami new APP
  hanami version

Other commands are available within a Hanami project's folder

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants