Created
April 17, 2020 13:05
-
-
Save Spartan322/7bc95854e6b728d6aec10fd16ac50fbc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var result = args.ReadArgs( | |
out var lastNamePos, | |
out var firstBadNamedArg, | |
new ArgAction( | |
new[] { "no-create", "c" }, | |
arg => { noCreate = true; }), | |
new ArgAction( | |
new[] { "date", "d" }, | |
arg => { if(DateTime.TryParse(arg.NextArgument, out var d)) date = d; }), | |
new ArgAction( | |
new[] { "no-dereference", "h" }, | |
arg => { affectSymlink = true; }), | |
new ArgAction( | |
new[] { "reference", "r" }, | |
arg => properties = Filesystem.CurrentDirectory.SearchForFile(arg.NextArgument).Properties), | |
new ArgAction( | |
"a", | |
arg => changeTimes |= 1 << 1), | |
new ArgAction( | |
"m", | |
arg => changeTimes |= 1 << 2), | |
new ArgAction( | |
"t", | |
arg => { if(DateTime.TryParseExact(arg.NextArgument, formats, CultureInfo.InvariantCulture, DateTimeStyles.AssumeLocal, out var d)) date = d; }), | |
new ArgAction( | |
"time", | |
arg => { | |
switch (arg.NextArgument?.ToLower()) | |
{ | |
case "access": | |
case "atime": | |
case "use": | |
changeTimes |= 1 << 1; | |
break; | |
case "modify": | |
case "mtime": | |
changeTimes |= 1 << 2; | |
break; | |
} | |
}), | |
new ArgAction( | |
"help", | |
arg => os.Write(Help.ActiveHelp)), | |
new ArgAction( | |
"version", | |
arg => os.Write($"{args[0]} (HacknetKernelUtilities) 0.1 (GNU emulated command)")) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment