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

CLI improvements #1437

Merged
merged 13 commits into from Mar 7, 2024
Merged

CLI improvements #1437

merged 13 commits into from Mar 7, 2024

Conversation

locksten
Copy link
Collaborator

@locksten locksten commented Mar 4, 2024

Description

  • Allows unknown cli options for integrations, since they're not known when commander is being set up.
  • Adds some TODO comments for other cli issues.
  • update cli logging
  • allow integrations to have single command tasks
  • fix relative path printouts

How to test integration:

cd packages/app-harness
rnv starter hello -p ios --my-opt=hello

# prints: Hello from Integration Starter!
# --my-opt: "hello"
cd packages/app-harness
rnv starter-single-command -p ios --my-opt=hello

# prints: Hello from Integration Starter!
# --my-opt: "hello"
Screenshot 2024-03-07 at 01 25 26 Screenshot 2024-03-07 at 01 25 37

TODO NOTES:

– integrations can't use options that rnv uses, like "--version", because rnv just prints its version and exits. => this is standard behavior of most CLIs so it's more about conventions
– when using executeAsync(), spaces must be manually escaped.

Related issues

n/a

Npm releases

n/a

@locksten locksten requested a review from pavjacko March 4, 2024 17:07
@locksten locksten marked this pull request as draft March 4, 2024 17:09
@locksten locksten removed the request for review from pavjacko March 4, 2024 17:09
@pavjacko pavjacko added this to the 1.0 milestone Mar 6, 2024
@pavjacko pavjacko marked this pull request as ready for review March 7, 2024 00:29
@pavjacko pavjacko added the e2e label Mar 7, 2024
@mihaiblaga89 mihaiblaga89 self-assigned this Mar 7, 2024
@Marius456 Marius456 self-requested a review March 7, 2024 09:24
@GabrieleKaceviciute
Copy link
Collaborator

@pavjacko is it expected?

  1. Print --my-opt: "undefined" in this way ->
➜  app-harness git:(feat/cli-updates) rnv

┌─────────────────────────────────────────────────────────────────┐
│ ██████╗ ███████╗███╗   ██╗ █████╗ ████████╗██╗██╗   ██╗███████╗ │
│ ██╔══██╗██╔════╝████╗  ██║██╔══██╗╚══██╔══╝██║██║   ██║██╔════╝ │
│ ██████╔╝█████╗  ██╔██╗ ██║███████║   ██║   ██║██║   ██║█████╗   │
│ ██╔══██╗██╔══╝  ██║╚██╗██║██╔══██║   ██║   ██║╚██╗ ██╔╝██╔══╝   │
│ ██║  ██║███████╗██║ ╚████║██║  ██║   ██║   ██║ ╚████╔╝ ███████╗ │
│ ╚═╝  ╚═╝╚══════╝╚═╝  ╚═══╝╚═╝  ╚═╝   ╚═╝   ╚═╝  ╚═══╝  ╚══════╝ │
│ 🚀 v:1.0.0-rc.12 | renative.org | 3/7/2024, 11:37:41 AM         │
│ $ rnv                                                           │
└─────────────────────────────────────────────────────────────────┘
? Pick a command starter-single-command (Prints hello message)
info: Running custom task starter-single-command
info: Current Engine: engine-core path: ../engine-core/lib
task: ○ starter-single-command [1]
info: ✔ Hello from Integration Starter single command!
--my-opt: "undefined"
task: ✔ starter-single-command [1]
┌─────────────────────────────────────────────────────────────────┐
│ ✔ SUMMARY | 3/7/2024, 11:37:47 AM | rnv@1.0.0-rc.12             │
│ $ rnv                                                           │
├─────────────────────────────────────────────────────────────────┤
│ Project Name ($package.name): @rnv/app-harness                  │
│ Project Version ($package.version): 1.0.0-rc.12                 │
│ Workspace ($.workspaceID): rnv                                  │
│ Engine: engine-core                                             │
│ Build Scheme (-s): debug                                        │
│ Env Info: darwin | arm64 | node v18.19.0                        │
│ Executed Time: 0h:0m:6s:71ms                                    │
│ info: ✔ Hello from Integration Starter single command!
--my-opt: "undefined"
└─────────────────────────────────────────────────────────────────┘
➜  app-harness git:(feat/cli-updates)
  1. If --my-opt value contains spaces -> printed only first word before space e.g. ->
➜  app-harness git:(feat/cli-updates) rnv starter hello --my-opt=bim bam

┌─────────────────────────────────────────────────────────────────┐
│ ██████╗ ███████╗███╗   ██╗ █████╗ ████████╗██╗██╗   ██╗███████╗ │
│ ██╔══██╗██╔════╝████╗  ██║██╔══██╗╚══██╔══╝██║██║   ██║██╔════╝ │
│ ██████╔╝█████╗  ██╔██╗ ██║███████║   ██║   ██║██║   ██║█████╗   │
│ ██╔══██╗██╔══╝  ██║╚██╗██║██╔══██║   ██║   ██║╚██╗ ██╔╝██╔══╝   │
│ ██║  ██║███████╗██║ ╚████║██║  ██║   ██║   ██║ ╚████╔╝ ███████╗ │
│ ╚═╝  ╚═╝╚══════╝╚═╝  ╚═══╝╚═╝  ╚═╝   ╚═╝   ╚═╝  ╚═══╝  ╚══════╝ │
│ 🚀 v:1.0.0-rc.12 | renative.org | 3/7/2024, 11:42:16 AM         │
│ $ rnv starter hello --my-opt=bim bam                            │
└─────────────────────────────────────────────────────────────────┘
info: Running custom task starter hello
info: Current Engine: engine-core path: ../engine-core/lib
task: ○ starter hello [1]
info: ✔ Hello from Integration Starter!
--my-opt: "bim"
task: ✔ starter hello [1]
┌─────────────────────────────────────────────────────────────────┐
│ ✔ SUMMARY | 3/7/2024, 11:42:16 AM | rnv@1.0.0-rc.12             │
│ $ rnv starter hello --my-opt=bim bam                            │
├─────────────────────────────────────────────────────────────────┤
│ Project Name ($package.name): @rnv/app-harness                  │
│ Project Version ($package.version): 1.0.0-rc.12                 │
│ Workspace ($.workspaceID): rnv                                  │
│ Engine: engine-core                                             │
│ Build Scheme (-s): debug                                        │
│ Env Info: darwin | arm64 | node v18.19.0                        │
│ Executed Time: 0h:0m:0s:99ms                                    │
│ info: ✔ Hello from Integration Starter!
--my-opt: "bim"
└─────────────────────────────────────────────────────────────────┘
➜  app-harness git:(feat/cli-updates)

@pavjacko
Copy link
Member

pavjacko commented Mar 7, 2024

@pauliusguzas yes. 2nd issue is not an issue but generic terminal behavior. you need to wrap such input in quotations
--my-opt="bim bam"

@pavjacko pavjacko merged commit 08f9a4c into release/1.0 Mar 7, 2024
1 check passed
@pavjacko pavjacko deleted the feat/cli-updates branch March 7, 2024 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants