From aea7b4a0e4ac371b44b85d9b6429a0a60924097c Mon Sep 17 00:00:00 2001 From: checkroom Date: Thu, 21 Nov 2024 10:46:30 +0000 Subject: [PATCH] Improving the vs CLI with correct profile handling, removed obsolete subcommands, implemented a temporary help file --- commons/HELP.md | 16 ++++++++++++++++ src/app/main.cpp | 40 ++++++++++++++++++++++++++-------------- 2 files changed, 42 insertions(+), 14 deletions(-) create mode 100644 commons/HELP.md diff --git a/commons/HELP.md b/commons/HELP.md new file mode 100644 index 00000000..e0d82931 --- /dev/null +++ b/commons/HELP.md @@ -0,0 +1,16 @@ +Using VS +======== + +- **help**: this command. +- **version**: to display versions of the dependencies it has been built with. +- **run**: `vs run FILE_PATH` to run an application. +- **test**: `vs test FILE_PATH ACTIONS_PATH ` to test an application. +- **editor**: to quickly run the embedded editor. +- **hub**: to open the use hub. + +If no argument is provided, it will open the default `hub` page. + +Variables of environment +------------------------ + +To be written \ No newline at end of file diff --git a/src/app/main.cpp b/src/app/main.cpp index 63d5354b..3805dc02 100755 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -68,9 +68,16 @@ int run(const char* path, const char *entry, const char* profile){ } } +int test(const char* path, const char *entry_file, const char* action_file, const char* profile){ + std::cerr<<"Not implemented yet\n"; + return 1; +} + int main(int argc, char **argv) { + const char* profile = getenv("VS_PROFILE"); + if(argc==1){ - return run(argv[0],"vs://hub.xml",nullptr); + return run(argv[0],"vs://hub.xml",profile); } else{ if(strcmp(argv[1],"run")==0){ @@ -79,7 +86,16 @@ int main(int argc, char **argv) { return 1; } - auto t =run(argv[0],argv[2],nullptr); + auto t =run(argv[0],argv[2],profile); + return t; + } + else if(strcmp(argv[1],"test")==0){ + if(argc<2){ + std::cerr<<"This application in test mode requires the path to a valid xml file or native component as first argument, and an xml file of actions as its second\n"; + return 1; + } + + auto t =test(argv[0],argv[2],argv[3],profile); return t; } else if(strcmp(argv[1],"version")==0){ @@ -96,23 +112,19 @@ int main(int argc, char **argv) { <<"libuv: "<