Function derive_output_path

Source
pub fn derive_output_path(input: impl AsRef<Path>) -> PathBuf
Expand description

Derives the output path from an input path.

Replaces the file extension with .json. If the input has no extension, .json is appended.

ยงExamples

use fernctl::commands::convert::derive_output_path;
use std::path::PathBuf;

assert_eq!(
    derive_output_path("config.toml"),
    PathBuf::from("config.json")
);

assert_eq!(
    derive_output_path("my-theme"),
    PathBuf::from("my-theme.json")
);