Skip to content
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
7 changes: 6 additions & 1 deletion src/cat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,17 @@ pub struct CatArgs {
pub fn run(args: CatArgs) -> Result<()> {
let mut output = String::new();
let root_path = Path::new(".");

// Load config and merge excludes
let config = crate::config::load_config(root_path)?;
let mut excludes = args.exclude_args.exclude.clone();
excludes.extend(config.exclude);

if let Some(id) = args.id {
cat_from_snapshot(id, root_path, &mut output)?;
} else {
let path = args.path.unwrap_or_else(|| PathBuf::from("."));
cat_from_workdir(&path, &args.exclude_args.exclude, &mut output)?;
cat_from_workdir(&path, &excludes, &mut output)?;
}

utils::handle_output(output, &args.output_args, "File content")
Expand Down
7 changes: 6 additions & 1 deletion src/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,14 @@ pub struct ModuleArgs {

pub fn run(args: ModuleArgs) -> Result<()> {
let mut output = String::new();

// Load config and merge excludes
let config = crate::config::load_config(std::path::Path::new("."))?;
let mut excludes = args.exclude_args.exclude.clone();
excludes.extend(config.exclude);

let mut glob_builder = GlobSetBuilder::new();
for pattern in &args.exclude_args.exclude {
for pattern in &excludes {
let glob = Glob::new(&format!("**/{}", pattern))?;
glob_builder.add(glob);
}
Expand Down