Skip to content

Commit

Permalink
Console options: move persistent to config verb
Browse files Browse the repository at this point in the history
  • Loading branch information
eltos committed Jan 31, 2024
1 parent 646c1b9 commit a301b1f
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions PasteIntoFile/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,6 @@ class ArgsCommon {
"May also contain a file extension and path fragment if used in paste mode.")]
public string Filename { get; set; }

[Option("text-extension", HelpText = "Set default file extension for text contents")]
public string TextExtension { get; set; }

[Option("image-extension", HelpText = "Set default file extension for image contents")]
public string ImageExtension { get; set; }

[Option('c', "clear", HelpText = "Clear clipboard after save (true/false)")]
public bool? ClearClipboard { get; set; }

Expand Down Expand Up @@ -67,6 +61,12 @@ class ArgsConfig : ArgsCommon {
[Option("subdir", HelpText = "Template for name of subfolder to create when holding CTRL (see filename for format variables)")]
public string Subdir { get; set; }

[Option("text-extension", HelpText = "Set default file extension for text contents")]
public string TextExtension { get; set; }

[Option("image-extension", HelpText = "Set default file extension for image contents")]
public string ImageExtension { get; set; }

[Option("register", HelpText = "Register context menu entry", SetName = "register")]
public bool RegisterContextMenu { get; set; }

Expand Down Expand Up @@ -165,13 +165,6 @@ static int DisplayHelp<T>(ParserResult<T> result, IEnumerable<Error> errs) {
/// <returns>Exit code</returns>
static int RunPaste(ArgsPaste args) {

// persistent options
if (args.TextExtension != null)
Settings.Default.extensionText = args.TextExtension;
if (args.ImageExtension != null)
Settings.Default.extensionImage = args.ImageExtension;
Settings.Default.Save();

bool? showDialogOverwrite = null;

// filename and directory (one time options)
Expand Down

0 comments on commit a301b1f

Please sign in to comment.