fix: create-config accepts YAML file name again instead of directory

pull/92/head
Robert Dailey 2 years ago
parent 1f7da24e82
commit 9618a0eadc

@ -17,6 +17,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Renamed the "EVO (no WEB-DL)" custom format to "EVO (no WEBDL)" in the config template. (#77)
- Radarr: `delete_old_custom_formats` works again. (#71)
- The `create-config` subcommand now accepts YAML files again (it was taking a directory before,
which was wrong).
[Docker]: https://github.com/recyclarr/recyclarr/wiki/Docker

@ -2,7 +2,7 @@
set -e
if [ ! -f "$HOME/recyclarr.yml" ]; then
su-exec recyclarr recyclarr create-config --path "$HOME"
su-exec recyclarr recyclarr create-config --path "$HOME/recyclarr.yml"
fi
appdata="--app-data $HOME"

@ -1,3 +1,5 @@
using System.IO.Abstractions;
using System.IO.Abstractions.Extensions;
using System.IO.Abstractions.TestingHelpers;
using AutoFixture.NUnit3;
using CliFx.Infrastructure;
@ -30,4 +32,23 @@ public class CreateConfigCommandTest
file.Should().NotBeNull();
file.Contents.Should().NotBeEmpty();
}
[Test, AutoMockData]
public async Task Config_file_created_when_using_user_specified_path(
[Frozen] IAppPaths paths,
[Frozen(Matching.ImplementedInterfaces)] MockFileSystem fs,
CreateConfigCommand cmd)
{
var ymlPath = fs.CurrentDirectory()
.SubDirectory("user")
.SubDirectory("specified")
.File("file.yml").FullName;
cmd.Path = ymlPath;
await cmd.ExecuteAsync(Substitute.For<IConsole>());
var file = fs.GetFile(ymlPath);
file.Should().NotBeNull();
file.Contents.Should().NotBeEmpty();
}
}

@ -36,11 +36,11 @@ public class CreateConfigCommand : ICommand
public ValueTask ExecuteAsync(IConsole console)
{
_appDataSetup.SetupDefaultPath(Path, true);
_appDataSetup.SetupDefaultPath(null, true);
var reader = new ResourceDataReader(typeof(Program));
var ymlData = reader.ReadData("config-template.yml");
var path = _paths.ConfigPath;
var path = _fs.Path.GetFullPath(Path ?? _paths.ConfigPath);
if (_fs.File.Exists(path))
{

Loading…
Cancel
Save