public static History From(Data.History rawHistory) { // null Created_By usually means the image was squashed var command = rawHistory.Created_By ?? string.Empty; string args = null; var argsm = argsRegex.Match(command); if (argsm.Success) { args = argsm.Groups[1].Value; command = argsm.Groups[2].Value; } var parsed = TryParse(command); return(new History { Command = rawHistory.Created_By, CommandArgs = args, Created = rawHistory.Created, ShortCommand = parsed.command, Type = parsed.type }); }
public static History From(Data.History rawHistory) { // null Created_By usually means the image was squashed var command = rawHistory.Created_By ?? string.Empty; string args = null; var argsm = new Regex(@"^\|\d(.+)(/bin/sh.*)$", RegexOptions.Compiled).Match(command); if (argsm.Success) { args = argsm.Groups[1].Value; command = argsm.Groups[2].Value; } var parsed = TryParse(command); return new History { Command = rawHistory.Created_By, CommandArgs = args, Created = rawHistory.Created, ShortCommand = parsed.command, Type = parsed.type }; }