Skip to content

Commit

Permalink
Interpret binary without name as clickhouse-local
Browse files Browse the repository at this point in the history
By "without name" I mean either of this:
- without arguments (except for the argv[0])
- or with arguments starts with dash

This should improve usability, and better ad of the clickhouse-local.

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
  • Loading branch information
azat committed Dec 29, 2023
1 parent 9e6cfaf commit 5394426
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions programs/main.cpp
Expand Up @@ -501,6 +501,11 @@ int main(int argc_, char ** argv_)
}
}

/// Interpret binary without argument or with arguments starts with dash
/// ('-') as clickhouse-local for better usability
if (main_func == printHelp && !argv.empty() && (argv.size() == 1 || argv[1][0] == '-'))
main_func = mainEntryClickHouseLocal;

return main_func(static_cast<int>(argv.size()), argv.data());
}
#endif

0 comments on commit 5394426

Please sign in to comment.