2014-03-04 16:39:34 +04:00
# Contributing
2016-07-19 16:54:26 +03:00
Contributions are most welcome! All `tldr` pages are stored in Markdown right here on GitHub. Just open an issue or send a pull request and we'll merge it as soon as possible.
2014-03-04 16:39:34 +04:00
2015-12-29 03:36:49 +03:00
*Note*: when submitting a new command, don't forget to check if there's already a pull request in progress.
2015-04-12 22:54:27 +03:00
2014-03-04 16:39:34 +04:00
## Guidelines
2015-08-25 03:16:26 +03:00
Note that `tldr` is focused on concrete examples.
2016-01-07 22:53:19 +03:00
Here are a few guidelines to get started:
2014-03-04 16:39:34 +04:00
2015-12-25 13:20:32 +03:00
1. Focus on the 5 or 6 most common usages. It's OK if the page doesn't cover everything; that's what `man` is for.
2. When in doubt, keep new command-line users in mind. Err on the side of clarity rather than terseness.
3. Try to incorporate the spelled-out version of single-letter options in the example's description.
4. Introduce options gradually, starting with the simplest commands and using more complex examples progressively.
5. Use short but descriptive values for the tokens, ex. `{{source_file}}` or `{{wallet.txt}}` .
2016-01-07 22:53:19 +03:00
6. Be specific: avoid explaining general UNIX concepts that could apply to any command (ex: relative/absolute paths, brace expansion, character escaping...).
2014-03-04 16:39:34 +04:00
2016-01-07 22:53:19 +03:00
The best way to be consistent is to have a look at a few existing pages :).
2014-03-04 16:39:34 +04:00
## Markdown format
2015-08-25 06:07:19 +03:00
The format of each page should match the following:
2014-03-04 16:39:34 +04:00
```
# command-name
2016-01-07 22:53:19 +03:00
> Short, snappy description.
2016-01-08 05:01:59 +03:00
> Preferably one line; two are acceptable if necessary.
2014-03-04 16:39:34 +04:00
2016-01-07 22:53:19 +03:00
- Example description:
2014-03-04 16:39:34 +04:00
2015-08-25 03:16:26 +03:00
`command -opt1 -opt2 -arg1 {{arg_value}}`
2014-03-04 16:39:34 +04:00
2016-01-07 22:53:19 +03:00
- Example description:
2014-03-04 16:39:34 +04:00
2015-08-25 03:16:26 +03:00
`command -opt1 -opt2`
2014-03-04 16:39:34 +04:00
```
2016-01-22 02:35:37 +03:00
We actually have a linter/formatter that enforces our format.
It even automatically cleans up your pages for you! Installing it is easy:
```
npm install
tldr tldrl
```
2016-01-07 22:53:19 +03:00
### Token Syntax
User-provided values should use the `{{token}}` syntax in order to allow clients
to highlight them.
2015-08-25 03:16:26 +03:00
2016-01-07 22:53:19 +03:00
Some examples:
- `tar cf {{file}}`
- `ln -s {{path/to/original/file}} {{path/to/link}}`
- `mysql {{database_name}}`
- `unrar x {{compressed.rar}}`
2016-01-08 05:01:59 +03:00
In short, make it as intuitive as possible for the user to figure out
how to use the command and fill it in with values.
Stick to [`snake_case` ](https://en.wikipedia.org/wiki/Snake_case ) where possible.
In some situations a command works with typical file extensions
(like the `unrar` example above); you are encouraged to add these for demonstration.
2016-01-07 22:53:19 +03:00
One of the reasons for this format is that it's well suited for command-line
clients that need to extract a single description/example.
2014-03-04 16:39:34 +04:00
2015-12-29 03:36:49 +03:00
## Submitting a pull request
2016-01-29 16:50:48 +03:00
TL;DR: fork, clone, `npm install` , feature branch, commit, push, pull request, check Travis.
2015-12-29 03:36:49 +03:00
Detailed explanation:
1. [Fork ](http://help.github.com/fork-a-repo/ ) the project, clone your fork,
and configure the remotes:
```bash
# Clone your fork of the repo into the current directory
git clone https://github.com/< your-username > /tldr
# Navigate to the newly cloned directory
cd tldr
# Assign the original repo to a remote called "upstream"
git remote add upstream https://github.com/tldr-pages/tldr
```
2016-01-19 22:44:37 +03:00
2. Setup pre-commit hooks with Markdown and TLDR linter.
2015-12-29 03:36:49 +03:00
```bash
2016-01-19 22:44:37 +03:00
# Assuming you have NodeJS
npm install
2015-12-29 03:36:49 +03:00
```
3. If you cloned a while ago, get the latest changes from upstream:
```bash
git checkout master
git pull upstream master
```
4. Create a new topic branch (sometimes they are called feature branches) off
the main project development branch:
```bash
git checkout -b < topic-branch-name >
```
2016-01-29 16:50:48 +03:00
5. Run `npm test` to check that your page(s) are correct. Try to run the commands you are describing to ensure the syntax is correct.
2015-12-29 03:36:49 +03:00
2016-01-19 16:28:43 +03:00
You can use the formatting features of [tldr-lint ](https://github.com/tldr-pages/tldr-lint )
2016-01-29 16:50:48 +03:00
(installed through `npm install` )
2016-01-19 16:28:43 +03:00
to automatically fix any mistakes you may have missed.
2016-01-19 16:28:43 +03:00
Try `tldr tldrl` for a quick how-to.
2016-01-19 16:28:43 +03:00
2015-12-29 03:36:49 +03:00
6. Please use the following commit message format:
`<command>: type of change` .
Examples:
- `ls: add page`
- `cat: fix typo`
- `git-push: add --force example`
- `uname: fix -a example`
7. Push your topic branch up to your fork:
```bash
git push origin < topic-branch-name >
```
8. [Open a Pull Request ](https://help.github.com/articles/using-pull-requests/ )
with a clear title and description.
2016-01-03 13:01:16 +03:00
If page is not about a standard Unix/Linux tool, please include a link to the tool home page.
If you are changing something non-trivial, not just adding a page for a new tool, please describe why you are doing this.
2015-12-29 03:36:49 +03:00
2016-01-25 01:37:37 +03:00
9. Verify that the automatically ran Travis CI build passed.
You can check this on your Pull Request; look for a green :heavy_check_mark: or red :x:.
10. Use Git's
2015-12-29 03:36:49 +03:00
[interactive rebase ](https://help.github.com/articles/interactive-rebase )
feature to tidy up your commits before making them public.
2016-01-03 13:01:16 +03:00
If you are not familiar with `git rebase` , it might be helpful to check out these video tutorials:
- [Git Rebase: squash last commits ](https://www.youtube.com/watch?v=qh9KtjfjzCU )
- [Learning Git Tutorial: Interactive Rebasing ](https://www.youtube.com/watch?v=NW46XmvJh5Q )
2015-12-29 03:36:49 +03:00
In most cases it is better to squash commits before submitting a pull request.
2016-01-25 01:37:37 +03:00
11. If you do not want to do a rebasing, you can overwrite your last commit in pull request, while you have only a single commit. You can achieve this with `git commit --amend` command.
2016-01-03 13:01:16 +03:00
```bash
# When you are on topic branch of your pull request
# Fix your files
git add . # Register edited files
git commit --amend # Do amended commit
git push --force # Overwrite your branch
```
2015-12-29 03:36:49 +03:00
## Licensing
`tldr` is under [MIT license ](https://github.com/tldr-pages/tldr/blob/master/LICENSE.md ).
2014-03-04 16:39:34 +04:00
2015-12-29 03:36:49 +03:00
**IMPORTANT**: By submitting a patch, you agree to license your work under the
same license as that used by the project.
2014-03-04 16:39:34 +04:00
You're free to modify or redistribute the content. That being said, but why not contribute over here? :) Say if you wanted to have `tldr` pages in `groff` format, why not have a client that uses [pandoc ](http://johnmacfarlane.net/pandoc/ ) and periodically updates straight from this repo?