diff --git a/apps/ls.cpp b/apps/ls.cpp index 646a3c61..4890ce1a 100644 --- a/apps/ls.cpp +++ b/apps/ls.cpp @@ -113,7 +113,7 @@ Result luna_main(int argc, char** argv) else { os::eprintln("%s: unknown sort type: %s", argv[0], sort_type.chars()); - return 1; + parser.short_usage(argv[0]); } if (os::FileSystem::is_directory(pathname, follow_symlink_args) && !list_directories) diff --git a/libos/include/os/ArgumentParser.h b/libos/include/os/ArgumentParser.h index 392ed9b2..1816da88 100644 --- a/libos/include/os/ArgumentParser.h +++ b/libos/include/os/ArgumentParser.h @@ -41,6 +41,8 @@ namespace os * Should not be used otherwise. */ void add_system_program_info(StringView name); + void short_usage(StringView program_name); + private: struct PositionalArgument { @@ -69,7 +71,6 @@ namespace os }; Result usage(StringView program_name); - void short_usage(StringView program_name); void version();