A command-line utility for running command in subdirectory with a set of pre-commit hooks
Project description
run-in-subdirectory
A command-line utility for running command in subdirectory with a set of pre-commit hooks
Usage
pre-commit hook
Example:
repos:
- repo: https://github.com/egormkn/run-in-subdirectory
rev: main
hooks:
# Run command in a subdirectory passed as the first argument
- id: run-in-subdirectory
alias: pylint
name: Lint Python sources
args: ["server", "pylint"]
types: [ python ]
files: ^server/
# Or use run-in-<N>-level-subdirectory hooks to extract
# subdirectory from the last file passed to the hook
- id: run-in-first-level-subdirectory
alias: prettier
name: Format code with Prettier
args: ["npx --no -- prettier -w -u"]
types: [ text ]
files: ^client/
command-line program
Install with pip:
pip install run-in-subdirectory
usage: run-in-subdirectory [-h] [-v] (-l LEVEL | -d DIRECTORY) executable [args ...]
Runs the command in a subdirectory and fixes paths in arguments.
positional arguments:
executable Executable to run
args Sequence of program arguments
options:
-h, --help show this help message and exit
-v, --verbose Print information about a command to be called
-l LEVEL, --level LEVEL
Subdirectory level (0 for top-level directory)
-d DIRECTORY, --directory DIRECTORY
Subdirectory within which the subprocess will be executed
example:
When this program is executed with the following command:
run-in-subdirectory -d client/ npx --no eslint client/src/index.ts
Then the command will be executed:
npx --no eslint src/index.ts
and the current working directory will be set to client/
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for run_in_subdirectory-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | b365ba0418dd24e8d575c134deae7de8381c0d2aed4a355bb6a048f995ff4601 |
|
MD5 | d17d13ec9e121e5038e3bf102eadb8ae |
|
BLAKE2b-256 | f75134f0dab3a74e731dae5cec22368a0f8a2ba2c618ada69db24ea7c08ffa99 |
Close
Hashes for run_in_subdirectory-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 887d724cfa69e8a5369f3e15ab1948deaddd74a03046e21ce54e49545ed682fa |
|
MD5 | e6880c6158617bd29e63c93d79e59217 |
|
BLAKE2b-256 | 3f35d4cceed02157e25df37913917dc5fdf2587f090451728b96b786fe598f39 |