Fix aos cli autocomplete config check
ReadConfig does the work of finding the config path, so it shouldn't be
assumed to be in the current directory.
Signed-off-by: Milind Upadhyay <milind.upadhyay@gmail.com>
Change-Id: I20552dfc002bfd6235dd2ac981d1d8ee245bd2e9
Signed-off-by: milind-u <milind.upadhyay@gmail.com>
diff --git a/aos/configuration.h b/aos/configuration.h
index c0e2715..cb52d09 100644
--- a/aos/configuration.h
+++ b/aos/configuration.h
@@ -18,11 +18,17 @@
namespace configuration {
// Reads a json configuration. This includes all imports and merges. Note:
-// duplicate imports will result in a CHECK.
+// duplicate imports or invalid paths will result in a FATAL.
FlatbufferDetachedBuffer<Configuration> ReadConfig(
const std::string_view path,
const std::vector<std::string_view> &extra_import_paths = {});
+// Reads a json configuration. This includes all imports and merges. Returns
+// std::nullopt on duplicate imports or invalid paths.
+std::optional<FlatbufferDetachedBuffer<Configuration>> MaybeReadConfig(
+ const std::string_view path,
+ const std::vector<std::string_view> &extra_import_paths = {});
+
// Sorts and merges entries in a config.
FlatbufferDetachedBuffer<Configuration> MergeConfiguration(
const Flatbuffer<Configuration> &config);