Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Add a .tccignore File for Automatic File Exclusion

Aug
2,816
147
I would like to suggest adding support for a .tccignore file in TCC.

The purpose of .tccignore would be to provide persistent,
directory-specific file-exclusion patterns for commands such as COPY, MOVE, and RENAME, without requiring the exclusion range to be specified every time.

TCC already supports file-exclusion ranges.

The documentation states that most internal commands that accept wildcards also accept file-exclusion ranges,
using syntax such as:

Code:
/[!pattern1 pattern2]

For example:

Code:
COPY  /s /[!*.bak *.bmark *.org transcript.md] *.* r:\test

This works well,
but the exclusion patterns must be included in each command line.

The relevant documentation is:

For a project directory,
I might want to exclude the following files from routine file operations:

Code:
*.bak
*.bmark
*.org
transcript.md

At present,
I can store those patterns in an environment variable and use that variable in a file-exclusion range.

For example:
Code:
SET tccignore=*.bak *.bmark *.org transcript.md
COPY /S /[!%tccignore] *.* R:\test

This still requires /[!%tccignore] to be added to every applicable command.

TCC already provides directory-specific environment configuration through DIRENV.

When enabled, TCC looks for .envtc files while changing directories and processes the files from the root of the new directory down to the current directory.


Because .envtc can define the tccignore variable,
it provides a workable method for configuring exclusion patterns on a per-directory basis.

However, the user must still explicitly include the corresponding file-exclusion range in each command.

A dedicated .tccignore file would make this behavior automatic and more discoverable.

When executing a command that selects files by wildcard,
TCC would search for .tccignore files according to a defined directory-search rule.

Patterns found in those files would automatically be applied as file exclusions.

For example, a .tccignore file could contain:

Code:
*.bak
*.bmark
*.org
transcript.md

Then commands such as these would automatically exclude matching files:

Code:
COPY * destination
MOVE * destination
RENAME *.txt *.old

The exact list of commands would be determined by which TCC commands support file selection and file-exclusion ranges.

It would be useful for the feature to include a way to:

  • Disable automatic .tccignore processing globally or temporarily.
  • Override or bypass .tccignore for a particular command.
  • Display the active exclusions, perhaps through an existing diagnostic option or a new command.
  • Distinguish an absent .tccignore file from an empty one.
  • Define how negated patterns or pattern precedence would work, if supported.

The idea is conceptually similar to Git’s .gitignore file,
which contains patterns for files that Git should ignore.

Git documents .gitignore patterns here:

The proposed .tccignore would serve a different purpose: it would not affect version control.

It would provide persistent file-selection exclusions for TCC commands.

TCC already has the necessary exclusion mechanism through file-exclusion ranges,
and DIRENV already provides directory-specific configuration.
A .tccignore file would combine these capabilities into a more convenient feature:

  • Define exclusions once.
  • Apply them automatically to applicable TCC commands.
  • Avoid repeating /[!...] on every command line.
  • Allow exclusions to follow a directory tree.
  • Keep the behavior separate from Git and other external tools.

This would be particularly useful for project directories containing backup files, generated files, editor files, transcripts, and other files that should normally be left untouched by routine COPY, MOVE, RENAME, and similar operations.

Joe
 
Could you get what you are looking for with a combination of DirEnv/.envtc you described above to set the tccignore variable and an alias?

e.g.

Code:
Alias Copy=`*Copy %@if[defined tccignore,/[!%tccignore],] %$`

I personally would prefer to be more explicit when ignoring certain files in a command, rather than having it implicitly done. So I'd be more likely to create something like a Copyi alias instead of aliasing the Copy command.
 
I personally would prefer to be more explicit when ignoring certain files in a command, rather than having it implicitly done. So I'd be more likely to create something like a Copyi alias instead of aliasing the Copy command.
It would only be in effect in a folder that contains the .tccignore file,
and would only affect the files in that folder,
and sub-folders.

In a folder that does not contain the .tccignore file,
no files would be affected.

Joe
 
Back
Top