ImageResizerRootCommand.cs
1 // Copyright (c) Microsoft Corporation 2 // The Microsoft Corporation licenses this file to you under the MIT license. 3 // See the LICENSE file in the project root for more information. 4 5 using System.CommandLine; 6 7 using ImageResizer.Cli.Options; 8 9 namespace ImageResizer.Cli.Commands 10 { 11 /// <summary> 12 /// Root command for the ImageResizer CLI. 13 /// </summary> 14 public sealed class ImageResizerRootCommand : RootCommand 15 { 16 public ImageResizerRootCommand() 17 : base("PowerToys Image Resizer - Resize images from command line") 18 { 19 HelpOption = new HelpOption(); 20 ShowConfigOption = new ShowConfigOption(); 21 DestinationOption = new DestinationOption(); 22 WidthOption = new WidthOption(); 23 HeightOption = new HeightOption(); 24 UnitOption = new UnitOption(); 25 FitOption = new FitOption(); 26 SizeOption = new SizeOption(); 27 ShrinkOnlyOption = new ShrinkOnlyOption(); 28 ReplaceOption = new ReplaceOption(); 29 IgnoreOrientationOption = new IgnoreOrientationOption(); 30 RemoveMetadataOption = new RemoveMetadataOption(); 31 QualityOption = new QualityOption(); 32 KeepDateModifiedOption = new KeepDateModifiedOption(); 33 FileNameOption = new FileNameOption(); 34 ProgressLinesOption = new ProgressLinesOption(); 35 FilesArgument = new FilesArgument(); 36 37 AddOption(HelpOption); 38 AddOption(ShowConfigOption); 39 AddOption(DestinationOption); 40 AddOption(WidthOption); 41 AddOption(HeightOption); 42 AddOption(UnitOption); 43 AddOption(FitOption); 44 AddOption(SizeOption); 45 AddOption(ShrinkOnlyOption); 46 AddOption(ReplaceOption); 47 AddOption(IgnoreOrientationOption); 48 AddOption(RemoveMetadataOption); 49 AddOption(QualityOption); 50 AddOption(KeepDateModifiedOption); 51 AddOption(FileNameOption); 52 AddOption(ProgressLinesOption); 53 AddArgument(FilesArgument); 54 } 55 56 public HelpOption HelpOption { get; } 57 58 public ShowConfigOption ShowConfigOption { get; } 59 60 public DestinationOption DestinationOption { get; } 61 62 public WidthOption WidthOption { get; } 63 64 public HeightOption HeightOption { get; } 65 66 public UnitOption UnitOption { get; } 67 68 public FitOption FitOption { get; } 69 70 public SizeOption SizeOption { get; } 71 72 public ShrinkOnlyOption ShrinkOnlyOption { get; } 73 74 public ReplaceOption ReplaceOption { get; } 75 76 public IgnoreOrientationOption IgnoreOrientationOption { get; } 77 78 public RemoveMetadataOption RemoveMetadataOption { get; } 79 80 public QualityOption QualityOption { get; } 81 82 public KeepDateModifiedOption KeepDateModifiedOption { get; } 83 84 public FileNameOption FileNameOption { get; } 85 86 public ProgressLinesOption ProgressLinesOption { get; } 87 88 public FilesArgument FilesArgument { get; } 89 } 90 }