New issue
Advanced search Search tips

Issue 769918 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Oct 2017
Cc:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Feature



Sign in to add a comment

Two more cros_config features

Project Member Reported by sjg@chromium.org, Sep 28 2017

Issue description

1. Allow access to non-root nodes in cros_config

cros_config /firmware bcs-overlay

currently it says 'cannot access non-root node /firmware'

2. Allow -m as an alias for --model in cros_config_host

it is shorter!

 
sjg@, is there a better command line flag parsing library I can use? From what I can tell the brillo stuff doesn't support abbreviations, commands (with sub-flags) or anything beyond super basic command line flags. The only way I can see right now to add a -m alias is to define an entirely new flag :(
Project Member

Comment 2 by bugdroid1@chromium.org, Sep 30 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform2/+/da6972a833e6d319c9571f1157e0e373f80f8f21

commit da6972a833e6d319c9571f1157e0e373f80f8f21
Author: Alec Thilenius <athilenius@chromium.org>
Date: Sat Sep 30 06:25:32 2017

chromeos-config: Added support for non-root paths in GetString

You can now pass in a non-root string to both cros_config and
cros_config_host to access any subnode of the Init*() model. For example
`cros_config /firmware bcs-overlay`.

BUG= chromium:769918 
TEST=Ran all unit tests including newly added

Change-Id: I6387d028cff7419772d8d944b7151e73df14b136
Reviewed-on: https://chromium-review.googlesource.com/692557
Commit-Ready: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

[modify] https://crrev.com/da6972a833e6d319c9571f1157e0e373f80f8f21/chromeos-config/libcros_config/cros_config_unittest.cc
[modify] https://crrev.com/da6972a833e6d319c9571f1157e0e373f80f8f21/chromeos-config/cros_config_main_unittest.cc
[modify] https://crrev.com/da6972a833e6d319c9571f1157e0e373f80f8f21/chromeos-config/cros_config_host_main_unittest.cc
[modify] https://crrev.com/da6972a833e6d319c9571f1157e0e373f80f8f21/chromeos-config/libcros_config/cros_config.cc

Comment 3 by sjg@chromium.org, Oct 1 2017

Cc: derat@chromium.org
I am sure there is a better library, but it seems to be the standard for Chrome OS. I suggest checking with derat on this as we need code to be consistent.

Comment 4 by derat@chromium.org, Oct 1 2017

Cc: jorgelo@chromium.org benchan@chromium.org
If cros_config needs to use base::CommandLine, then flag_helper.h from libbrillo is the only option that I know of.

If you wanted to add additional features to it, like the ability to register an alias for an already-registered flag or the ability to precede values with whitespace instead of with '=', I wouldn't complain. Not sure if it's worth the effort to avoid typing --model, though.
We've mentioned this before, but given that there's interest to keep improving libbrillo, we should just put it back in platform2.

I agree with Dan here: is it really worth it to add new functionality to flag_helper just for this use in cros_config?

Comment 6 by sjg@chromium.org, Oct 2 2017

OK, well it's not worth bringing in a new library for -m. Let's drop that feature.
Status: Fixed (was: Untriaged)

Sign in to add a comment