spryker-sdk / brancho
Builds nice branch names.
Installs: 95 410
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 13
Forks: 1
Open Issues: 2
Requires
- php: >=8.0
- chobie/jira-api-restclient: ^2.0@dev
- cocur/slugify: ^4.0
- laminas/laminas-filter: ^2.9
- symfony-cmf/slugifier-api: ^2.0
- symfony/console: ^6.0
- symfony/options-resolver: ^6.0
- symfony/process: ^6.0
- symfony/yaml: ^6.0
Requires (Dev)
- codeception/codeception: ^5.0
- codeception/module-asserts: ^2.0
- codeception/module-phpbrowser: ^2.0.0
- mikey179/vfsstream: ^1.6
- phpstan/phpstan: ^1.10
- spryker/code-sniffer: ^0.17.18
- symfony/var-dumper: ^6.0
This package is auto-updated.
Last update: 2024-11-05 03:19:27 UTC
README
Brancho is a tool that helps to create branches with a defined naming convention. It is also capable of committing your changes.
Installation
It is recommended that you install Brancho globally:
composer global require spryker-sdk/brancho
If you want it in your project go into your project folder and run:
composer require spryker-sdk/brancho --dev
Add brancho to executable path
export PATH=/path/to/vendor/bin
On Ubuntu 20.04 the path should be ~/.config/composer/vendor/bin
Configuration
After the installation you will need to configure brancho. The default configuration file is named .brancho
. You basically only need to define the resolver that should be used.
resolver: \Full\Qualified\ClassName
You can also configure filters here, or you add the required filters to your resolver.
Additionally you can have a .brancho.local
that holds configurations only needed by you e.g. credentials.
Commands
Brancho offers the following commands:
brancho branch
- to create a branch.brancho commit
- to commit changes.
You can use -h
for both commands to get more information about their usage.
Command alias
You should create aliases for both commands to make them even more easy to use.
Examples:
alias bb=brancho branch
alias bc=brancho commit
alias bca=brancho commit -a
Resolver
Resolvers are used to resolve branch names. A resolver can receive information from anywhere.
To build your own resolver you need to implement the \Brancho\Resolver\ResolverInterface
. You will then have access to :
\Symfony\Component\Console\Input\InputInterface
\Symfony\Component\Console\Output\OutputInterface
\Brancho\Context\ContextInterface
Symfony's interfaces can be used to retrieve input data or to ask for any user input. Read more about this in Symfony's documentation.
Through the \Brancho\Context\ContextInterface
you get access to the configuration and to the configured filters.
Filters
Filters are used to filter user input into a normalized format. Think of a user input which is copied from somewhere e.g. an issue name or a short description. Usually these contain whitespaces and capital letters which are not allowed in git branch names.
Get Jira API token
Go to https://id.atlassian.com/manage-profile/security/api-tokens and create a new API token.
Example configuration
resolver: \Brancho\Resolver\JiraResolver
filters:
- \Brancho\Filter\Slugify
jira:
host: https://spryker.atlassian.net/
username: foo.bar@spryker.com
password: {YOUR-API-TOKEN}