@@ -63,30 +63,121 @@ namespace vix::commands::DevCommand
6363 std::ostream &out = std::cout;
6464
6565 out << " Usage:\n " ;
66- out << " vix dev [name ] [options] [-- app- args...]\n\n " ;
66+ out << " vix dev [target ] [options] [-- compiler/linker flags] [--run < args...> ]\n\n " ;
6767
6868 out << " Description:\n " ;
69- out << " Developer-friendly entrypoint that configures, builds and runs a Vix.cpp\n " ;
70- out << " application in dev mode with auto-reload.\n " ;
71- out << " Internally, this is equivalent to calling `vix run` with `--watch` enabled\n " ;
72- out << " (for both single-file scripts and CMake-based projects).\n\n " ;
73-
74- out << " Options:\n " ;
75- out << " --force-server Force classification as 'dev server'\n " ;
76- out << " --force-script Force classification as 'script'\n " ;
77- out << " --watch, --reload Enable hot reload (enabled by default in dev)\n " ;
78- out << " -j, --jobs <n> Number of parallel compile jobs\n " ;
79- out << " --log-level <level> Override log verbosity (trace, debug, info, warn, error, critical)\n " ;
80- out << " --verbose Shortcut for debug logs\n " ;
81- out << " -q, --quiet Only show warnings and errors\n\n " ;
69+ out << " Start a C++ project or script in development mode.\n " ;
70+ out << " vix dev builds the target, runs it when possible, watches file changes,\n " ;
71+ out << " and rebuilds or restarts automatically.\n\n " ;
72+
73+ out << " Targets:\n " ;
74+ out << " current project vix dev\n " ;
75+ out << " project directory/name vix dev api\n " ;
76+ out << " single C++ file vix dev server.cpp\n " ;
77+ out << " manifest file vix dev app.vix\n\n " ;
78+
79+ out << " Project behavior:\n " ;
80+ out << " application project build, run, watch, restart on changes\n " ;
81+ out << " library project build, watch, rebuild on changes\n " ;
82+ out << " single C++ file compile, run, watch, rebuild on save\n\n " ;
83+
84+ out << " Project options:\n " ;
85+ out << " -d, --dir <path> Project directory\n " ;
86+ out << " --dir=<path> Same as --dir <path>\n " ;
87+ out << " --preset <name> Configure/build preset, default: dev-ninja\n " ;
88+ out << " --preset=<name> Same as --preset <name>\n " ;
89+ out << " --run-preset <name> Run preset name\n " ;
90+ out << " --run-preset=<name> Same as --run-preset <name>\n " ;
91+ out << " -j, --jobs <n> Number of parallel build jobs\n " ;
92+ out << " --jobs=<n> Same as --jobs <n>\n " ;
93+ out << " --clean Clean/reconfigure before starting dev mode\n " ;
94+ out << " --replay Record runs under .vix/runs/\n\n " ;
95+
96+ out << " Runtime arguments and environment:\n " ;
97+ out << " --cwd <path> Run the program from this working directory\n " ;
98+ out << " --cwd=<path> Same as --cwd <path>\n " ;
99+ out << " --env <K=V> Add or override one environment variable\n " ;
100+ out << " --env=<K=V> Same as --env <K=V>\n " ;
101+ out << " --args <value> Add one runtime argument, repeatable\n " ;
102+ out << " --args=<value> Same as --args <value>\n " ;
103+ out << " --run <args...> Runtime args for script mode\n\n " ;
104+
105+ out << " Watch mode:\n " ;
106+ out << " --watch Enabled by default in vix dev\n " ;
107+ out << " --reload Alias for --watch\n " ;
108+ out << " --force-server Treat the program as a long-running server\n " ;
109+ out << " --force-script Treat the program as a short-lived script\n\n " ;
110+
111+ out << " Script mode:\n " ;
112+ out << " --auto-deps Auto-add includes from .vix/deps/*/include\n " ;
113+ out << " --auto-deps=local Same as --auto-deps\n " ;
114+ out << " --auto-deps=up Search deps in parent folders too\n " ;
115+ out << " --san Enable ASan and UBSan\n " ;
116+ out << " --ubsan Enable UBSan only\n " ;
117+ out << " --tsan Enable ThreadSanitizer only\n " ;
118+ out << " --with-sqlite Enable SQLite support\n " ;
119+ out << " --with-mysql Enable MySQL support\n " ;
120+ out << " --local-cache Use local .vix-scripts cache\n\n " ;
121+
122+ out << " Documentation:\n " ;
123+ out << " --docs Enable OpenAPI/docs for this run\n " ;
124+ out << " --no-docs Disable OpenAPI/docs for this run\n " ;
125+ out << " --docs=<0|1|true|false> Explicitly control OpenAPI/docs\n\n " ;
126+
127+ out << " Output and logging:\n " ;
128+ out << " --clear <auto|always|never> Clear terminal before runtime output\n " ;
129+ out << " --clear=<auto|always|never> Same as --clear <mode>\n " ;
130+ out << " --no-clear Alias for --clear=never\n " ;
131+ out << " --log-level <level> trace, debug, info, warn, error, critical, off\n " ;
132+ out << " --log-level=<level> Same as --log-level <level>\n " ;
133+ out << " --verbose Alias for --log-level=debug\n " ;
134+ out << " -q, --quiet Alias for --log-level=warn\n " ;
135+ out << " --log-format <format> kv, json, json-pretty\n " ;
136+ out << " --log-format=<format> Same as --log-format <format>\n " ;
137+ out << " --log-color <mode> auto, always, never\n " ;
138+ out << " --log-color=<mode> Same as --log-color <mode>\n " ;
139+ out << " --no-color Alias for --log-color=never\n " ;
140+ out << " -h, --help Show this help\n\n " ;
141+
142+ out << " Compiler/linker flags:\n " ;
143+ out << " -- [flags...] In script mode, pass flags to the compiler\n " ;
144+ out << " Example: vix dev server.cpp -- -O2 -lssl\n\n " ;
145+
146+ out << " Important:\n " ;
147+ out << " vix dev already enables watch mode.\n " ;
148+ out << " For script runtime args, use --run or --args.\n " ;
149+ out << " Everything after -- is treated as compiler/linker flags.\n\n " ;
82150
83151 out << " Examples:\n " ;
84- out << " vix dev # run current app with auto-reload\n " ;
85- out << " vix dev api # run 'api' app in dev mode\n " ;
86- out << " vix dev server.cpp # script mode with auto-rebuild on save\n " ;
87- out << " vix dev server.cpp -- --port 8080\n " ;
88- out << " vix dev server.cpp --force-server # treat it as a long-lived server\n " ;
89- out << " vix dev tool.cpp --force-script # treat it as a CLI tool\n\n " ;
152+ out << " vix dev\n " ;
153+ out << " vix dev api\n " ;
154+ out << " vix dev --dir ./examples/blog\n " ;
155+ out << " vix dev --preset dev-ninja\n " ;
156+ out << " vix dev --clean\n " ;
157+ out << " vix dev --reload\n " ;
158+ out << " vix dev --force-server api\n " ;
159+ out << " vix dev --force-script tool.cpp\n " ;
160+ out << " vix dev api --args --port --args 8080\n " ;
161+ out << " vix dev api --cwd ./runtime\n " ;
162+ out << " vix dev api --env PORT=8080\n " ;
163+ out << " vix dev main.cpp\n " ;
164+ out << " vix dev main.cpp --run hello 123\n " ;
165+ out << " vix dev main.cpp --args hello --args 123\n " ;
166+ out << " vix dev main.cpp --with-sqlite\n " ;
167+ out << " vix dev main.cpp --with-mysql\n " ;
168+ out << " vix dev main.cpp --san\n " ;
169+ out << " vix dev main.cpp -- -O2 -DNDEBUG\n " ;
170+ out << " vix dev app.vix\n " ;
171+ out << " vix dev app.vix --args --port --args 8080\n\n " ;
172+
173+ out << " Environment variables:\n " ;
174+ out << " VIX_DOCS 0 or 1\n " ;
175+ out << " VIX_LOG_LEVEL trace, debug, info, warn, error, critical, off\n " ;
176+ out << " VIX_LOG_FORMAT kv, json, json-pretty\n " ;
177+ out << " VIX_COLOR auto, always, never\n " ;
178+ out << " VIX_STDOUT_MODE line\n " ;
179+ out << " VIX_CLI_CLEAR auto, always, never\n " ;
180+ out << " VIX_SHOW_ENV_HINT=1 Show .env hint when .env.example exists\n\n " ;
90181
91182 return 0 ;
92183 }
0 commit comments