Allow specifying target for get
Change-Id: I4d8c6e7e445a613a384ef16f06448c101e37abcc
diff --git a/src/grammars.hpp b/src/grammars.hpp
index 71af580..2220b76 100644
--- a/src/grammars.hpp
+++ b/src/grammars.hpp
@@ -131,8 +131,22 @@
delete_::name >> space_separator > (presenceContainerPath | listInstancePath | leafListElementPath | writableLeafPath);
#endif
+const auto dsTargetSuggestions = staticSuggestions({"running", "startup", "operational"});
+
+struct ds_target_table : x3::symbols<DatastoreTarget> {
+ ds_target_table()
+ {
+ add
+ ("operational", DatastoreTarget::Operational)
+ ("startup", DatastoreTarget::Startup)
+ ("running", DatastoreTarget::Running);
+ }
+} const ds_target_table;
+
auto const get_def =
- get_::name >> -(space_separator >> getPath);
+ get_::name
+ >> -(space_separator >> "-" > staticSuggestions({"-datastore"}) > "-datastore" > space_separator > dsTargetSuggestions > ds_target_table)
+ >> -(space_separator >> getPath);
auto const set_def =
set_::name >> space_separator > writableLeafPath > space_separator > leaf_data;
@@ -332,18 +346,6 @@
auto const exec_def =
exec_::name > -(space_separator > -as<dataPath_>[RpcActionPath<AllowInput::No>{}]);
-const auto dsTargetSuggestions = staticSuggestions({"running", "startup", "operational"});
-
-struct ds_target_table : x3::symbols<DatastoreTarget> {
- ds_target_table()
- {
- add
- ("operational", DatastoreTarget::Operational)
- ("startup", DatastoreTarget::Startup)
- ("running", DatastoreTarget::Running);
- }
-} const ds_target_table;
-
auto const switch_rule_def =
switch_::name > space_separator > dsTargetSuggestions > ds_target_table;