Skip to content

Commit c747098

Browse files
authored
Merge pull request #1200 from wakatime/docs/project-config-usage
Docs for project config feature
2 parents 8e448c3 + c6aaea8 commit c747098

File tree

2 files changed

+48
-28
lines changed

2 files changed

+48
-28
lines changed

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Go to [http://wakatime.com/editors][editors] to install the plugin for your text
1414
Normally you don't need to use wakatime-cli directly unless you're building a new WakaTime plugin.
1515
If you're building a plugin using the [WakaTime API][api], follow the [Creating a Plugin][creating-plugin] guide.
1616

17-
WakaTime plugins and wakatime-cli share a common [INI][ini] config file:
17+
WakaTime plugins and wakatime-cli share a common [INI][usage] config file:
1818

1919
`$WAKATIME_HOME/.wakatime.cfg`
2020

@@ -37,7 +37,6 @@ Made with :heart: by the WakaTime Team.
3737
[editors]: http://wakatime.com/editors
3838
[api]: https://wakatime.com/developers/
3939
[creating-plugin]: https://wakatime.com/help/misc/creating-plugin
40-
[ini]: http://en.wikipedia.org/wiki/INI_file
4140
[faq]: https://wakatime.com/faq
4241
[usage]: USAGE.md
4342
[contributing]: CONTRIBUTING.md

USAGE.md

Lines changed: 47 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,33 +5,10 @@ Options can be passed to wakatime-cli via command line, or set in the `$WAKATIME
55
Command line arguments take precedence over config file settings.
66
Run `wakatime-cli --help` for available command line options.
77

8-
## Project Detection
9-
10-
WakaTime auto-detects your projects.
11-
12-
The priority of projects detection is:
13-
14-
1. [.wakatime-project file](#wakatime-project-file)
15-
16-
2. [project map](#project-map-section)
17-
18-
3. Version control (Git)
19-
20-
4. IDE project
21-
22-
See the [source code](https://github.com/wakatime/wakatime-cli/blob/36f6372880d7113382e99453c2b94ff727788ae2/pkg/project/project.go#L145) for specifics.
8+
## Config File
239

24-
### WakaTime Project File
25-
26-
To overwrite the auto-detected project, create a `.wakatime-project` file in your project’s root folder.
27-
The first line of the file contents overwrites the project name, if present.
28-
The second line, if present, overwrites the current branch name when working inside this folder.
29-
When the `.wakatime-project` file is empty, the folder’s name is used as the project name.
30-
Whenever a `.wakatime-project` file is found, it overwrites all other project detection.
31-
32-
## INI Config File
33-
34-
Here's an example `$WAKATIME_HOME/.wakatime.cfg` config file with all available options:
10+
After [installing WakaTime][plugins], a minimal `$WAKATIME_HOME/.wakatime.cfg` config file will be created for you.
11+
You can add to that config file with these available options:
3512

3613
```ini
3714
[settings]
@@ -84,6 +61,24 @@ some/submodule/name = new project name
8461
^/home/user/projects/bar(\d+)/ = project{0}
8562
```
8663

64+
### Project Config
65+
66+
Creating a `.wakatime` file in your project will overwrite your main `~/.wakatime.cfg` configs with the ones in your project config.
67+
For example, if you want to ignore files in a `build` folder for `some-project`, but not in other projects then create a `.wakatime` file in `some-project` folder with these contents:
68+
69+
```ini
70+
[settings]
71+
exclude =
72+
/build/
73+
^COMMIT_EDITMSG$
74+
^TAG_EDITMSG$
75+
^/var/(?!www/).*
76+
^/etc/
77+
```
78+
79+
Now any time spent working on files in any `build` folder will be ignored in `some-project` but not in `other-project`.
80+
Notice how you have to include the exclude patterns from your main `~/.wakatime.cfg` or they'll be overwritten.
81+
8782
### Settings Section
8883

8984
| option | description | type | default value |
@@ -160,7 +155,33 @@ some/submodule/name = new project name
160155

161156
For commonly used configuration options, see examples in the [FAQ](https://wakatime.com/faq).
162157

158+
## Project Detection
159+
160+
WakaTime auto-detects your projects.
161+
162+
The priority of projects detection is:
163+
164+
1. [.wakatime-project file](#wakatime-project-file)
165+
166+
2. [project map](#project-map-section)
167+
168+
3. Version control (Git)
169+
170+
4. IDE project
171+
172+
See the [source code](https://github.com/wakatime/wakatime-cli/blob/36f6372880d7113382e99453c2b94ff727788ae2/pkg/project/project.go#L145) for specifics.
173+
174+
### WakaTime Project File
175+
176+
To overwrite the auto-detected project, create a `.wakatime-project` file in your project’s root folder.
177+
The first line of the file contents overwrites the project name, if present.
178+
The second line, if present, overwrites the current branch name when working inside this folder.
179+
When the `.wakatime-project` file is empty, the folder’s name is used as the project name.
180+
Whenever a `.wakatime-project` file is found, it overwrites all other project detection.
181+
163182
## Internal INI Config File
164183

165184
The plugins and wakatime-cli use a separate internal INI file for things like caching auto-update requests to the GitHub releases API, and exponential backoff to the WakaTime API.
166185
The default internal INI config file location is `$WAKATIME_HOME/.wakatime/wakatime-internal.cfg`.
186+
187+
[plugins]: https://wakatime.com/plugins

0 commit comments

Comments
 (0)