57 lines
1.5 KiB
C#
57 lines
1.5 KiB
C#
using Common;
|
|
namespace CLI;
|
|
|
|
class Program
|
|
{
|
|
static string BINARY_NAME = "pass";
|
|
|
|
static int Main(string[] args)
|
|
{
|
|
//ConfigFileManager.ExceptionOccured += (e) => ErrorOccured(e);
|
|
//ConfigFileManager.Init();
|
|
|
|
if (args.Length == 0)
|
|
{
|
|
ListPasswords();
|
|
return 0;
|
|
}
|
|
else
|
|
{
|
|
switch (args[0])
|
|
{
|
|
case "help":
|
|
HelpMessage();
|
|
break;
|
|
default:
|
|
HelpMessage();
|
|
break;
|
|
}
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
static void ListPasswords()
|
|
{
|
|
|
|
}
|
|
|
|
static void ErrorOccured(Exception e)
|
|
{
|
|
Console.WriteLine($"The following error occured while trying to load your profile:\n{e}\nMore details:\n{e.ToString()}");
|
|
}
|
|
|
|
static void HelpMessage()
|
|
{
|
|
Console.WriteLine($"Usage: {BINARY_NAME} <arguments> [optional arguments]");
|
|
Console.WriteLine("\nArguments:");
|
|
Console.WriteLine("\t- list:\t\t\tlist all passwords; this is the default action");
|
|
Console.WriteLine("\t- <password>:\t\tdecrypt password and copy it to clipboard");
|
|
Console.WriteLine($"\t- new <name>:\t\tgenerate password\n\t\t[length]:\tthe length of the password, default is {PasswordGenerator.DEFAULT_LENGTH}\n\t\t[true|false]:\twhether the password should include symbols, default is true");
|
|
Console.WriteLine($"\t- rm <password>:\tdelete password");
|
|
Console.WriteLine($"\t- insert <password>:\tinstead of generating the password, you enter its contents");
|
|
Console.WriteLine($"\t- find <search query>:\tlist password that match your query");
|
|
Console.WriteLine($"\t- edit <password>:\tedit the contents of an existing password");
|
|
}
|
|
}
|