Skip to content

refactor: drop --debug flag #166

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

Merged
merged 1 commit into from
Feb 21, 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
35 changes: 5 additions & 30 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ rayon = "*"
rnix = "*"
termion = "*"
tui = { version = "*", default-features = false, features = ["termion"] }
rowan = "*"
rowan = "0.12.6" # follows rnix
walkdir = "*"

[package]
Expand Down
7 changes: 0 additions & 7 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,6 @@ pub fn parse(args: Vec<String>) -> clap::ArgMatches {
clap::Command::new("Alejandra")
.about("The Uncompromising Nix Code Formatter.")
.version(crate::version::VERSION)
.arg(
clap::Arg::new("debug")
.help("Enable debug mode.")
.long("debug")
.short('d')
.takes_value(false),
)
.arg(
clap::Arg::new("paths")
.help("Files or directories, or none to format stdin.")
Expand Down
13 changes: 2 additions & 11 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,19 @@ pub enum Layout {

#[derive(Clone)]
pub struct Config {
debug: bool,
layout: Layout,
}

impl Config {
pub fn new() -> Config {
Config { debug: false, layout: Layout::Tall }
}

pub fn debug(&self) -> bool {
self.debug
Config { layout: Layout::Tall }
}

pub fn layout(&self) -> &Layout {
&self.layout
}

pub fn with_debug(&self, debug: bool) -> Config {
Config { debug, layout: self.layout.clone() }
}

pub fn with_layout(&self, layout: Layout) -> Config {
Config { debug: self.debug, layout }
Config { layout }
}
}
27 changes: 0 additions & 27 deletions src/debug.rs

This file was deleted.

4 changes: 0 additions & 4 deletions src/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ pub fn string(
let green_node =
crate::builder::build(config, ast.node().into(), false, path).unwrap();

if config.debug() {
crate::debug::display(&(&green_node).into());
}

green_node.to_string()
}

Expand Down
1 change: 0 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ pub mod builder;
pub mod children;
pub mod cli;
pub mod config;
pub mod debug;
pub mod find;
pub mod format;
pub mod position;
Expand Down
3 changes: 1 addition & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
fn main() -> std::io::Result<()> {
let matches = alejandra::cli::parse(std::env::args().collect());

let debug: bool = matches.is_present("debug");
let config = alejandra::config::Config::new().with_debug(debug);
let config = alejandra::config::Config::new();

match matches.values_of("paths") {
Some(paths) => {
Expand Down