1
0
mirror of synced 2024-11-05 02:59:16 +00:00
Tapeti/Tapeti.Cmd/Parser/BindingParser.cs
2021-09-04 11:33:59 +02:00

24 lines
634 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
namespace Tapeti.Cmd.Parser
{
public static class BindingParser
{
public static Tuple<string, string>[] Parse(IEnumerable<string> bindings)
{
return bindings
.Select(b =>
{
var parts = b.Split(':');
if (parts.Length != 2)
throw new InvalidOperationException($"Invalid binding format: {b}");
return new Tuple<string, string>(parts[0], parts[1]);
})
.ToArray();
}
}
}