private static void ProcessArguments(HexRangeArguments argParser) { var radius = argParser.KRadius; var origin = new H3Index(argParser.Origin); var showDistance = argParser.Print; if (!origin.IsValid()) { Console.WriteLine("0"); return; } var lookup = origin.KRingDistances(radius); StringBuilder sb = new StringBuilder(); foreach (var pair in lookup) { sb.Clear(); sb.Append(pair.Key.ToString()); if (showDistance) { sb.Append($" {pair.Value}"); } Console.WriteLine(sb.ToString()); } }
static void Main(string[] args) { using var parser = new CommandLineParser.CommandLineParser(); args = args.Select(s => s.ToLower()).ToArray(); try { var argParser = new HexRangeArguments(); parser.ExtractArgumentAttributes(argParser); parser.ParseCommandLine(args); ProcessArguments(argParser); } catch (Exception) { Console.WriteLine("Unable to parse input."); parser.ShowUsage(); } }