Add simple argument parser and help text
This commit is contained in:
parent
9614e6400f
commit
f25c054b48
|
@ -27,9 +27,10 @@ namespace tgcli;
|
||||||
|
|
||||||
// ReSharper disable once InconsistentNaming
|
// ReSharper disable once InconsistentNaming
|
||||||
public static class tgcli {
|
public static class tgcli {
|
||||||
public const bool lockInputToBottom = true;
|
public const string version = "0.4a";
|
||||||
public static volatile Td.TdClient client = new();
|
public static volatile bool lockInputToBottom;
|
||||||
public static string dbdir = "";
|
public static volatile Td.TdClient client = new();
|
||||||
|
public static string dbdir = "";
|
||||||
public static volatile bool authorized;
|
public static volatile bool authorized;
|
||||||
public static volatile string connectionState = "Connecting";
|
public static volatile string connectionState = "Connecting";
|
||||||
public static long currentChatId = 0;
|
public static long currentChatId = 0;
|
||||||
|
@ -47,8 +48,24 @@ public static class tgcli {
|
||||||
public static volatile object @lock = new();
|
public static volatile object @lock = new();
|
||||||
|
|
||||||
private static void Main(string[] args) {
|
private static void Main(string[] args) {
|
||||||
if (args.Length == 1 && args[0] == "-s")
|
if (args.Contains("-s"))
|
||||||
silent = true;
|
silent = true;
|
||||||
|
|
||||||
|
if (args.Contains("-l"))
|
||||||
|
lockInputToBottom = true;
|
||||||
|
|
||||||
|
if (args.Contains("-h") || args.Contains("-?") || args.Contains("--help")) {
|
||||||
|
Console.WriteLine($"""
|
||||||
|
tgcli v{version}
|
||||||
|
Laura Hausmann <laura@hausmann.dev>
|
||||||
|
Source Code: https://git.ztn.sh/zotan/tgcli
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
-s Silent mode. Disables terminal bell on new message.
|
||||||
|
-l Locks input line to bottom, like in an IRC client.
|
||||||
|
""");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
dbdir = RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
|
dbdir = RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
|
||||||
? $"{Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)}{Path.DirectorySeparatorChar}.tgcli"
|
? $"{Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)}{Path.DirectorySeparatorChar}.tgcli"
|
||||||
|
@ -361,7 +378,7 @@ public static class tgcli {
|
||||||
SystemLanguageCode = "en_US",
|
SystemLanguageCode = "en_US",
|
||||||
DeviceModel = Environment.MachineName,
|
DeviceModel = Environment.MachineName,
|
||||||
SystemVersion = ".NET Core CLR " + Environment.Version,
|
SystemVersion = ".NET Core CLR " + Environment.Version,
|
||||||
ApplicationVersion = "0.3a",
|
ApplicationVersion = version,
|
||||||
EnableStorageOptimizer = true,
|
EnableStorageOptimizer = true,
|
||||||
UseSecretChats = true
|
UseSecretChats = true
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue