semvec/pypi-packages huggingface dataset:
smart-find 1.0.5
smart-find makes it easier to access the advanced features of find and grep
License: Apache-2.0
Requires Python: >=3.10
Keywords: development

# smart-find

smart-find makes it easier to access the advanced features of
find and grep.

## Usage

Use the `-help` option to show the smart-find usage.

```bash
    $ smart-find -help
    Usage: smart-find

        -help               - print this help
        -contains (-c)      - grep for string in found files
        -ignore-case (-i)   - ignore case when greping
        -iname (-in)        - ignore case of filenames
        -save-config        - write the default config
                              into /Users/barry/Library/Preferences/smart-find.json
        -debug              - print the find command line
        -<int>              - limit find to a max depth of <int>
```

## configuration

smart-find follows the conventions of macOS and Linux XDG to look for configuration files.

You can see the default configuration file path in the `smart-find -help` output

* macos - `~/Library/Preferences/smart-find.json`
* linux - `~/.config/smart-find.json`

Use the `smart-find -save-config` to create a config file with the default
configuration options:

The default configuration is:

```json
    {
        "folders_to_prune": [".svn", ".git", ".hg"],
        "files_to_prune":   ["*~"]
    }
```

The following items are supported:

* folders_to_prune is a list of folders that will be ignored
* files_to_prune is a list of file patterns that will be ignored
colour-filter 1.1.2
The colour-filter command reads lines from it's input, colours parts of the line and prints the result on it's output
License: Apache-2.0
Requires Python: >=3.10
Keywords: development

# colour_filter module and colour-filter command - colour parts of lines

## colour-filter command

The `colour-filter` command reads lines from its input,
colours parts of the line and prints the result on its output.

For example colour the output of a build script. Colour `Info:` in green
and all of the line that starts `Error:` in red.

``` bash
   $ ./build.sh 2>&1 | colour-filter '^Info:' green 'Error:.*' red
```

## colour_filter module

`ColourFilter` class

- `__init__()`

    Create instance of ColourFilter.

- `enableDebug( enable=True )`

    Turn on the debug output to help understand why patterns are not matching as expected.

- `define( pattern, colour )`

    When the regular express `pattern` is found in a line of input colour it as `colour` on the output.

    `colour` is either the string name of a list colour name seperated by ':' or ';'.
    E.g. `'red'` or 'red;bg-white'

    The builtin foreground colour names are:

        bold, black, brown, green, yellow, blue,
        magenta, cyan, gray, red, lightred, lightgreen,
        lightyellow, lightblue, lightmagenta, lightcyan
        ans white.

    The builtin background colour names are:

        bg-black, bg-brown, bg-green, bg-yellow,
        bg-blue, bg-magenta, bg-cyan, bg-gray
        and bg-white.

- `filterLines( input_file, output_file, line_buffered )`

    Read lines from `input_file` until end-of-file.
    Replace all matching patterns with their defined colour.
    Write each converted line to `output_file` and if `line_buffered` is `True`
    call `flush()` on the `output_file`.

### Example that colours lines of `build.log`

``` python
    from colour_filter import ColourFilter

    f = ColourFilter()
    f.define( 'Info:', 'green' )
    f.define( 'Error:', 'red;bg-white' )

    with open( 'build.log' ) as input_file:
        f.filterLines( input_file, sys.stdout, line_buffered=False )

```