From c638ce83c6b82fb47ec5856ea24065257c722458 Mon Sep 17 00:00:00 2001 From: BanceDev Date: Sat, 7 Sep 2024 23:39:31 -0400 Subject: added --version flag --- src/lush.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/lush.c b/src/lush.c index 1f11482..69aa055 100644 --- a/src/lush.c +++ b/src/lush.c @@ -567,7 +567,14 @@ int lush_run(lua_State *L, char ***commands, int num_commands) { return lush_execute_pipeline(commands, num_commands); } -int main() { +int main(int argc, char *argv[]) { + // check if the --version arg was passed + if (argc > 1 && strcmp(argv[1], "--version") == 0) { +#ifdef LUSH_VERSION + printf("Lunar Shell, version %s\n", LUSH_VERSION); +#endif + return 0; + } lua_State *L = luaL_newstate(); luaL_openlibs(L); lua_register_api(L); @@ -628,4 +635,5 @@ int main() { free(line); } lua_close(L); + return 0; } -- cgit v1.2.3-59-g8ed1b