Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated commands #290

Merged
merged 3 commits into from
Oct 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion docs/src/usage.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ OPTIONS:
-r, --raw Display the raw markdown instead of rendering it
-q, --quiet Suppress informational messages
--show-paths Show file and directory paths used by tealdeer
--config-path Show config file path
--seed-config Create a basic config
--color <WHEN> Control whether to use color [possible values: always, auto, never]
-v, --version Print the version
Expand Down
22 changes: 0 additions & 22 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,6 @@ pub(crate) struct Args {
)]
pub platform: Option<PlatformType>,

/// Deprecated alias of `platform`
#[clap(
short = 'o',
long = "os",
possible_values = ["linux", "macos", "windows", "sunos", "osx"],
hide = true
)]
pub os: Option<PlatformType>,

/// Override the language
#[clap(short = 'L', long = "language")]
pub language: Option<String>,
Expand All @@ -76,15 +67,6 @@ pub(crate) struct Args {
#[clap(short = 'r', long = "--raw", requires = "command_or_file")]
pub raw: bool,

/// Deprecated alias of `raw`
#[clap(
long = "markdown",
short = 'm',
requires = "command_or_file",
hide = true
)]
pub markdown: bool,

/// Suppress informational messages
#[clap(short = 'q', long = "quiet")]
pub quiet: bool,
Expand All @@ -93,10 +75,6 @@ pub(crate) struct Args {
#[clap(long = "show-paths")]
pub show_paths: bool,

/// Show config file path
#[clap(long = "config-path")]
pub config_path: bool,

/// Create a basic config
#[clap(long = "seed-config")]
pub seed_config: bool,
Expand Down
40 changes: 1 addition & 39 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,19 +140,6 @@ fn update_cache(cache: &Cache, quietly: bool, enable_styles: bool) {
}
}

/// Show the config path (DEPRECATED)
fn show_config_path(enable_styles: bool) {
match get_config_path() {
Ok((config_file_path, _)) => {
println!("Config path is: {}", config_file_path.to_str().unwrap());
}
Err(e) => {
print_error(enable_styles, &e.context("Could not look up config path"));
process::exit(1);
}
}
}

/// Show file paths
fn show_paths(config: &Config) {
let config_dir = get_config_dir().map_or_else(
Expand Down Expand Up @@ -253,7 +240,7 @@ fn main() {
init_log();

// Parse arguments
let mut args = Args::parse();
let args = Args::parse();

// Determine the usage of styles
#[cfg(target_os = "windows")]
Expand All @@ -274,31 +261,6 @@ fn main() {
ColorOptions::Never => false,
};

// Handle renamed arguments
if args.markdown {
args.raw = true;
print_warning(
enable_styles,
"The -m / --markdown flag is deprecated, use -r / --raw instead",
);
}
if args.os.is_some() {
print_warning(
enable_styles,
"The -o / --os flag is deprecated, use -p / --platform instead",
);
}
args.platform = args.platform.or(args.os);

// Show config file and path, pass through
if args.config_path {
print_warning(
enable_styles,
"The --config-path flag is deprecated, use --show-paths instead",
);
show_config_path(enable_styles);
}

// Look up config file, if none is found fall back to default config.
let config = match Config::load(enable_styles) {
Ok(config) => config,
Expand Down