-
Notifications
You must be signed in to change notification settings - Fork 262
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prompt user before overwriting files (#1085)
* Create destination file immediately * Fix potential NRE * Implement FileOverwriteHandler for CLI * Add GetNonCollidingName tests * TwitchDownloaderArgs -> ITwitchDownloaderArgs & rearrange arg interfaces due to help text ordering * Update help text * Create WPF task file overwrite handler * Throw when no output file is returned, refresh FileInfos before checking Exists property * Genericize opening explorer for a given file * Update ___Options output file property to reflect possibly new filename * Add icon * Add translations * Annotate as windows only * Update README * Forgot to add it to the whole CLI * Overwrite -> Collision * Missed a few spots * Update wording * Use warning icon to match file explorer overwrite prompt * Make "remember my choice" wording more clear * Fix missing zh-cn translations
- Loading branch information
Showing
54 changed files
with
960 additions
and
156 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,19 @@ | ||
using CommandLine; | ||
using TwitchDownloaderCLI.Models; | ||
|
||
namespace TwitchDownloaderCLI.Modes.Arguments | ||
{ | ||
[Verb("cache", HelpText = "Manage the working cache")] | ||
internal sealed class CacheArgs : TwitchDownloaderArgs | ||
internal sealed class CacheArgs : ITwitchDownloaderArgs | ||
{ | ||
[Option('c', "clear", Default = false, Required = false, HelpText = "Clears the default cache folder.")] | ||
public bool ClearCache { get; set; } | ||
|
||
[Option("force-clear", Default = false, Required = false, HelpText = "Clears the default cache folder, bypassing the confirmation prompt")] | ||
public bool ForceClearCache { get; set; } | ||
|
||
// Interface args | ||
public bool? ShowBanner { get; set; } | ||
public LogLevel LogLevel { get; set; } | ||
} | ||
} |
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,16 @@ | ||
using CommandLine; | ||
using TwitchDownloaderCLI.Models; | ||
|
||
namespace TwitchDownloaderCLI.Modes.Arguments | ||
{ | ||
[Verb("ffmpeg", HelpText = "Manage standalone ffmpeg")] | ||
internal sealed class FfmpegArgs : TwitchDownloaderArgs | ||
internal sealed class FfmpegArgs : ITwitchDownloaderArgs | ||
{ | ||
[Option('d', "download", Default = false, Required = false, HelpText = "Downloads FFmpeg as a standalone file.")] | ||
public bool DownloadFfmpeg { get; set; } | ||
|
||
// Interface args | ||
public bool? ShowBanner { get; set; } | ||
public LogLevel LogLevel { get; set; } | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using CommandLine; | ||
using TwitchDownloaderCLI.Models; | ||
|
||
namespace TwitchDownloaderCLI.Modes.Arguments | ||
{ | ||
internal interface IFileCollisionArgs | ||
{ | ||
[Option("collision", Default = OverwriteBehavior.Prompt, HelpText = "Sets the handling of output file name collisions. Valid values are: Overwrite, Exit, Rename, Prompt.")] | ||
public OverwriteBehavior OverwriteBehavior { get; set; } | ||
} | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,20 @@ | ||
using CommandLine; | ||
using TwitchDownloaderCLI.Models; | ||
|
||
namespace TwitchDownloaderCLI.Modes.Arguments | ||
{ | ||
[Verb("tsmerge", HelpText = "Concatenates multiple .ts/.tsv/.tsa/.m2t/.m2ts (MPEG Transport Stream) files into a single file")] | ||
internal sealed class TsMergeArgs : TwitchDownloaderArgs | ||
internal sealed class TsMergeArgs : IFileCollisionArgs, ITwitchDownloaderArgs | ||
{ | ||
[Option('i', "input", Required = true, HelpText = "Path a text file containing the absolute paths of the files to concatenate, separated by newlines. M3U/M3U8 is also supported.")] | ||
public string InputList { get; set; } | ||
|
||
[Option('o', "output", Required = true, HelpText = "Path to output file.")] | ||
public string OutputFile { get; set; } | ||
|
||
// Interface args | ||
public OverwriteBehavior OverwriteBehavior { get; set; } | ||
public bool? ShowBanner { get; set; } | ||
public LogLevel LogLevel { get; set; } | ||
} | ||
} |
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
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
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
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
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
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
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
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
Oops, something went wrong.