mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2026-04-24 23:13:48 +00:00
Use nullable
This commit is contained in:
@@ -7,7 +7,6 @@ using CliFx.Utilities;
|
||||
using DiscordChatExporter.Core.Models;
|
||||
using DiscordChatExporter.Core.Services;
|
||||
using DiscordChatExporter.Core.Services.Helpers;
|
||||
using Tyrrrz.Extensions;
|
||||
|
||||
namespace DiscordChatExporter.Cli.Commands
|
||||
{
|
||||
@@ -22,7 +21,7 @@ namespace DiscordChatExporter.Cli.Commands
|
||||
public ExportFormat ExportFormat { get; set; } = ExportFormat.HtmlDark;
|
||||
|
||||
[CommandOption("output", 'o', Description = "Output file or directory path.")]
|
||||
public string OutputPath { get; set; }
|
||||
public string? OutputPath { get; set; }
|
||||
|
||||
[CommandOption("after",Description = "Limit to messages sent after this date.")]
|
||||
public DateTimeOffset? After { get; set; }
|
||||
@@ -34,7 +33,7 @@ namespace DiscordChatExporter.Cli.Commands
|
||||
public int? PartitionLimit { get; set; }
|
||||
|
||||
[CommandOption("dateformat", Description = "Date format used in output.")]
|
||||
public string DateFormat { get; set; }
|
||||
public string? DateFormat { get; set; }
|
||||
|
||||
protected ExportCommandBase(SettingsService settingsService, DataService dataService, ExportService exportService)
|
||||
: base(dataService)
|
||||
@@ -46,8 +45,8 @@ namespace DiscordChatExporter.Cli.Commands
|
||||
protected async Task ExportChannelAsync(IConsole console, Channel channel)
|
||||
{
|
||||
// Configure settings
|
||||
if (!DateFormat.IsNullOrWhiteSpace())
|
||||
SettingsService.DateFormat = DateFormat;
|
||||
if (!string.IsNullOrWhiteSpace(DateFormat))
|
||||
SettingsService.DateFormat = DateFormat!;
|
||||
|
||||
console.Output.Write($"Exporting channel [{channel.Name}]... ");
|
||||
var progress = console.CreateProgressTicker();
|
||||
@@ -57,7 +56,7 @@ namespace DiscordChatExporter.Cli.Commands
|
||||
|
||||
// Generate file path if not set or is a directory
|
||||
var filePath = OutputPath;
|
||||
if (filePath.IsNullOrWhiteSpace() || ExportHelper.IsDirectoryPath(filePath))
|
||||
if (string.IsNullOrWhiteSpace(filePath) || ExportHelper.IsDirectoryPath(filePath))
|
||||
{
|
||||
// Generate default file name
|
||||
var fileName = ExportHelper.GetDefaultExportFileName(ExportFormat, chatLog.Guild,
|
||||
|
||||
Reference in New Issue
Block a user