comby-tools/comby

comby ignores files in current dir or explicitly provided dir when its hidden

tekumara opened this issue · 3 comments

Describe the bug

When using templates and the current directory is a hidden directory (or the -d dir is hidden) comby ignores the files.

Reproducing

❯ pwd
/Users/tekumara/code/myapp/.teamcity
❯ ll
total 40
-rw-r--r--  1 tekumara  staff   4.5K 24 Jun 11:06 settings.kts
❯ comby -config ../comby-patch-settings.toml -f .kts -stats
{
  "number_of_files": 0,
  "lines_of_code": 0,
  "number_of_matches": 0,
  "total_time": 40.49396514892578
}
❯ cd ..
❯ pwd
/Users/tekumara/code/myapp
❯ comby -config ../comby-patch-settings.toml -f .kts -stats -d .teamcity
{
  "number_of_files": 0,
  "lines_of_code": 0,
  "number_of_matches": 0,
  "total_time": 40.49396514892578
}

Expected behavior

When using templates, and the current dir is a hidden directory, or a hidden directory is explicitly provided via -d then comby should work on this files.

Additional context

comby 1.8.1

A work around whilst there's no fix is to provide an empty template and the explicit file names, which produces a warning but will work on the files in the hidden directory:

❯ comby -config comby-patch-teamcity.toml -matcher .txt -f .kts "" "" .teamcity/* -stats
WARNING: Templates specified on the command line AND using -templates. Ignoring match
      and rewrite templates on the command line and only using those in directories.
....      
{
  "number_of_files": 1,
  "lines_of_code": 285,
  "number_of_matches": 0,
  "total_time": 92.39006042480469
}

Thanks--looks like this conflicts with --exclude-dir which by default excludes any directories starting with ..

When a flag specifies -d explicitly, I agree it should just work.

In the mean time you can probably use the workaround --exclude-dir "" -d .teamcity (didn't check, but it should work)

Thanks for looking into this! When I try -exclude-dir "" I get:

Error parsing command line:

  failed to parse -exclude-dir value "".
  (Failure "Command.Spec.Arg_type.comma_separated: empty list not allowed")

For usage information, run

  comby -help