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

Add FML command line to nimbus-cli #5784

Merged
merged 5 commits into from Aug 18, 2023
Merged

Conversation

jhugman
Copy link
Contributor

@jhugman jhugman commented Aug 17, 2023

Fixes EXP-3772.

Pull Request checklist

  • Breaking changes: This PR follows our breaking change policy
    • This PR follows the breaking change policy:
      • This PR has no breaking API changes, or
      • There are corresponding PRs for our consumer applications that resolve the breaking changes and have been approved
  • Quality: This PR builds and tests run cleanly
    • Note:
      • For changes that need extra cross-platform testing, consider adding [ci full] to the PR title.
      • If this pull request includes a breaking change, consider cutting a new release after merging.
  • Tests: This PR includes thorough tests or an explanation of why it does not
  • Changelog: This PR includes a changelog entry in CHANGELOG.md or an explanation of why it does not need one
    • Any breaking changes to Swift or Kotlin binding APIs are noted explicitly
  • Dependencies: This PR follows our dependency management guidelines
    • Any new dependencies are accompanied by a summary of the due dilligence applied in selecting them.

Branch builds: add [firefox-android: branch-name] to the PR title.

@codecov-commenter
Copy link

codecov-commenter commented Aug 17, 2023

Codecov Report

Patch coverage: 85.47% and project coverage change: -0.22% ⚠️

Comparison is base (fc10f63) 37.13% compared to head (4ec178d) 36.91%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5784      +/-   ##
==========================================
- Coverage   37.13%   36.91%   -0.22%     
==========================================
  Files         330      331       +1     
  Lines       33150    33051      -99     
==========================================
- Hits        12309    12201     -108     
- Misses      20841    20850       +9     
Files Changed Coverage Δ
components/support/nimbus-cli/src/main.rs 86.99% <0.00%> (-0.57%) ⬇️
...t/nimbus-fml/src/backends/experimenter_manifest.rs 81.01% <ø> (-7.88%) ⬇️
...ents/support/nimbus-fml/src/backends/kotlin/mod.rs 47.74% <ø> (ø)
components/support/nimbus-fml/src/backends/mod.rs 93.87% <ø> (ø)
...nents/support/nimbus-fml/src/backends/swift/mod.rs 24.56% <ø> (ø)
...ts/support/nimbus-fml/src/command_line/commands.rs 61.53% <ø> (ø)
components/support/nimbus-fml/src/error.rs 11.36% <ø> (ø)
...us-fml/src/fixtures/intermediate_representation.rs 100.00% <ø> (ø)
...port/nimbus-fml/src/intermediate_representation.rs 96.85% <ø> (ø)
components/support/nimbus-fml/src/lib.rs 100.00% <ø> (ø)
... and 5 more

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@jeddai jeddai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I've got a question but otherwise I don't really have any concerns.

I will say it took me a minute to realize that if I want to pass flags I have to add them after a -- despite the tip for it.

Comment on lines 15 to 28
// We prepend the string `nimbus-cli fml` to the args to pass to FML
// because the clap uses the 0th argument for help messages.
let first = OsStr::new("nimbus-cli fml").to_os_string();
let mut cli_args = vec![&first];

// To make this a little more ergonomic, if the user has just typed
// `nimbus-cli fml`, then we can help them a little bit.
let help = OsStr::new("--help").to_os_string();
if args.is_empty() {
cli_args.push(&help);
} else {
cli_args.extend(args);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain this a bit more? Sorry I'm not following the comments well enough to fully understand.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, I'll update the comment; however, let me try here:

  1. clap uses the zeroth argument in the command line in help and error messages, so the FML clap would report an error with a usage messagenimbus-cli fml generate [OPTIONS] <INPUT> <OUTPUT> instead of nimbus-fml generate [OPTIONS] <INPUT> <OUTPUT>.
  2. If the user types nimbus-cli fml, it would give a rather unfriendly not implemented: Command not implemented; if/when we change the nimbus-fml cli to use clap derive, as we do in the CLI, this would change. Until then, add the --help flag to display the usage message.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahhhh gotcha okay cool. Thanks!

@jhugman jhugman force-pushed the jhugman/exp-3772-fml-from-cli branch from 939ec48 to 4ec178d Compare August 18, 2023 18:59
@jhugman jhugman enabled auto-merge August 18, 2023 18:59
@jhugman jhugman added this pull request to the merge queue Aug 18, 2023
Merged via the queue into main with commit 28691d9 Aug 18, 2023
14 of 16 checks passed
@jhugman jhugman deleted the jhugman/exp-3772-fml-from-cli branch August 18, 2023 20:01
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

Successfully merging this pull request may close these issues.

None yet

3 participants