From 6b82bc6d1221bc89651e9cd982f4eb5d24dc4918 Mon Sep 17 00:00:00 2001 From: Laura Hausmann Date: Wed, 22 Jul 2020 12:38:14 +0200 Subject: [PATCH] Updates --- Program.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Program.cs b/Program.cs index 975b3fb..bf5b822 100644 --- a/Program.cs +++ b/Program.cs @@ -14,6 +14,9 @@ namespace repomgr { public static RepoMgr Repo; public static void Main(string[] args) { + if (args.Length < 2 || args[1].Equals("help")) + PrintHelp(); + if (File.Exists("/tmp/repomgr.lock") && args[1] != "daemon") { Console.WriteLine("/tmp/repomgr.lock exists, delete it if you are sure no other process is running"); Environment.Exit(1); @@ -22,12 +25,10 @@ namespace repomgr { File.Create("/tmp/repomgr.lock"); } - if (args.Length < 2 || args[1].Equals("help")) - PrintHelp(); - Repo = new RepoMgr(args[0]); if (File.Exists(Path.Combine(args[0], "repomgr.index.json"))) Repo.ReadIndex(); + switch (args[1]) { case "daemon": CreateHostBuilder(args).Build().Run(); @@ -130,7 +131,6 @@ namespace repomgr { } private static void PrintHelp() { - //TODO: add/remove [...] Console.WriteLine("Usage:"); Console.WriteLine("repomgr init "); Console.WriteLine("repomgr list"); @@ -140,6 +140,9 @@ namespace repomgr { Console.WriteLine("repomgr update [...] [-f] [--skip-checks]"); Console.WriteLine("repomgr update-all"); Console.WriteLine("repomgr daemon"); + if (File.Exists("/tmp/repomgr.lock")) + File.Delete("/tmp/repomgr.lock"); + Environment.Exit(0); } public static IHostBuilder CreateHostBuilder(string[] args) =>