timoschinkel / codeowners-cli
A cli interface for the codeowners library
Installs: 72
Dependents: 0
Suggesters: 0
Security: 0
Stars: 5
Watchers: 1
Forks: 1
Open Issues: 2
Type:project
Requires
- php: ^8.0, <8.3
- symfony/console: ^6.0
- symfony/finder: ^6.0
- timoschinkel/codeowners: ^2.0
Requires (Dev)
- mikey179/vfsstream: ^1.6
- phpspec/prophecy-phpunit: ^2.0
- phpunit/phpunit: ^9.4
- squizlabs/php_codesniffer: ^3.5
- vimeo/psalm: ^4.2
README
Code owners CLI is a CLI interface to simplify common operations on Code owners files using timoschinkel/codeowners
.
Installation
Use Composer for installation:
composer require timoschinkel/codeowners-cli
If you don't want Code owners CLI to be part of your project to can opt to install it globally:
composer global require timoschinkel/codeowners-cli
Usage
When installed as dependency of your project:
./vendor/bin/codeowners [options] <command>
When installed globally:
codeowners [options] <command>
NB When installed globally you will need to install Composer itself globally add the global Composer binary folder to your PATH
variable, eg by adding the following line to ~/.bash_profile
or ~/.bashrc
:
export PATH=~/.composer/vendor/bin:$PATH
All commands have the options supplied by Symfony Console:
-q
,--quiet
; Do no output any message-v|vv|vvv
,--verbose
; Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
When no CODEOWNERS file is specified - using -c
or --codeowners
- the application will search the CODEOWNERS file in the following locations based on the working directory:
<working_dir>/.github/CODEOWNERS
<working_dir>/.bitbucket/CODEOWNERS
<working_dir>/.gitlab/CODEOWNERS
<working_dir>/CODEOWNERS
<working_dir>/docs/CODEOWNERS
Calling the command with the verbose option will print what file is used when applicable.
Available commands
owner
Shows the owner of the path(s) passed as parameter.
Usage: owner [options] [--] <paths>... Arguments: paths Paths to files or directories to show code owner, separate with spaces Options: -c, --codeowners=CODEOWNERS Location of code owners file, defaults to <working_dir>/CODEOWNERS
For example:
codeowners owner ./src
list-files
Shows all files for an owner:
Usage: list-files [options] [--] <owner> <paths>... Arguments: owner Codeowner for which the files should be listed paths Paths to files or directories to show code owner, separate with spaces Options: -c, --codeowners=CODEOWNERS Location of code owners file, defaults to <working_dir>/CODEOWNERS
For example:
codeowners list-files @team ./src
The output of this command can be used to feed into other tools using xargs
:
codeowners list-files @team ./src | xargs <command>
list-unowned-files
Shows all files that don't have an owner specified:
Usage: list-unowned-files [options] [--] <paths>... Arguments: paths Paths to files or directories to show code owner, separate with spaces Options: -c, --codeowners=CODEOWNERS Location of code owners file, defaults to <working_dir>/CODEOWNERS
For example:
codeowners list-unowned-files ./src
list-owners
Shows all available owners inside the found CODEOWNERS file.
Usage: list-owners [options] Options: -c, --codeowners=CODEOWNERS Location of code owners file, defaults to <working_dir>/CODEOWNERS
For example:
codeowners list-owners