diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..9fb5256e --- /dev/null +++ b/LICENSE @@ -0,0 +1,7 @@ +Copyright © 2018 Martien Oranje + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md index 9c462c2f..fcf6502a 100644 --- a/README.md +++ b/README.md @@ -2,13 +2,13 @@ # ALFRED TODOIST WORKFLOW -Add and search [Todoist](https://todoist.com/) tasks straight from [Alfred](https://www.alfredapp.com). It uses Todoist `v8` REST API. +Add and search [Todoist](https://todoist.com/) tasks straight from [Alfred](https://www.alfredapp.com). It uses Todoist `v8` [REST API](https://developer.todoist.com/rest/v8/). -| Jump to: | [Prerequisites](#prerequisites) | [Installation](#installation) | [Add Tasks](#add-tasks) | [Search and Browse Tasks](#search-and-browse-tasks) | [Configuration](#configuration) | -| :------: | :-----------------------------: | :---------------------------: | :---------------------: | :-------------------------------------------------: | :-----------------------------: | +| [Getting started](#getting-started) | [Installation](#installation) | [Configuration](#configuration) | [Usage](#usage) | [Contributing](#contributing) | +| :---------------------------------: | :---------------------------: | :-----------------------------: | :-------------: | :---------------------------: | -## Prerequisites +## Getting started - For this workflow to work you need version `3.x` of Alfred and a powerpack licence. - [Node.js](https://nodejs.org/en/download/) @@ -17,40 +17,38 @@ Add and search [Todoist](https://todoist.com/) tasks straight from [Alfred](http [Download](https://github.com/moranje/alfred-workflow-todoist/raw/master/dist/Alfred%20Workflow%20Todoist.alfredworkflow) and import workflow. -For updates use the `todo:update` command. - -## Add Tasks - -### Alfred command - -`todo {task}, {date}` - -Example: _todo Get things done, tomorrow @ 9_ -Example: _todo Build tree house #home !!2 @15min, tomorrow @ 9_ - -#### Task - -Can be any string as long as there are no comma's in it. Markdown in the string will be parsed (in the Todoist app), but anything else won't. - -#### Date - -See the [Todoist documentation](https://support.todoist.com/hc/en-us/articles/205325931-Dates-and-Times) for supported date formats. +## Configuration -#### Project\* +| Name | Notation | Explanation | +| ---------------------- | ------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | +| _token_ | `^[0-9a-fA-F]{40}$` (default empty) | The todoist API token. | +| _language_ | `en`, `da`, `pl`, `zh`, `ko`, `de`, `pt`, `ja`, `it`, `fr`, `sv`, `ru`, `es`, `nl` (default `en`) | The language for natural language date processing (by todoist) and to calculate time to complete a task. | +| _cache_timeout_ | A positive number (default `3600`, an hour) | The time (in seconds) until the cache is refreshed (until that time todoist information is stored locally to make things a little faster) | +| _anonymous_statistics_ | `true` or `false` (default `true`) | Doesn't do much at the moment but I intent to use it to track installs | -Add task to an existing project. If no project is selected the task will be added to your inbox. Use either the hashtag notation `#project` or if the project has spaces in it `#[in box]`. Project names are case insensitive. +`todo:setting token {api token}` +Example: _todo:setting token 2d2e2a334c5f36e7a7c43b46e_ -#### Labels\* +`todo:setting language {language}` +Example: _todo:setting language nl_ -You can add labels to your tasks using the `@` character. Label names are case insensitive and can't contain any whitespace characters. +`todo:setting cache_timeout {time in seconds}` +Example: _todo:setting cache_timeout 13_ -#### Priority +`todo:setting anonymous_statistics {true or false}` +Example: _todo:setting anonymous_statistics false_ -A number between `1` and `4`, where `1` is the highest and `4` would be the lowest (and default) priority. +## Usage -## Search and Browse Tasks +| Name | Notation | Explanation | +| ---------- | --------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ | +| _task_ | Any text except `,` | The task title. | +| _date_ | A date string | See the [Todoist documentation](https://support.todoist.com/hc/en-us/articles/205325931-Dates-and-Times) for supported date formats. | +| _project_ | Either `#personal` or `#[next actions]` | Use either the hashtag notation or bracket notation if the project name has spaces in it. The project name is case insensitive. | +| _label_ | `@label` | Label names can't contain any whitespace characters. Labels are case insensitive. | +| _priority_ | Either `p2` or `!!2` | A value between `1` (urgent) and `4` (normal) | -### Alfred command +### Search for tasks `todos {query}` @@ -64,51 +62,60 @@ Example: `todos car` => returns (because of fuzzy search): - _New_ **ca**_t_ **r**_ecipe's_ - **C**_ut Gr_**a**_s tomo_**r**_row_ -## Configuration +### Create task -Some magic will happen when you run the `t` command, like creation of files and refreshing of todoist data cache. Other than that use it to configure the workflow. +`todo {task}, {date}` -### Alfred commands +Example: _todo Get things done, tomorrow @ 9_ +Example: _todo Build tree house #home !!2 @15min, tomorrow @ 9_ -`todo:setting token {api token}` (no default) -Example: _todo:setting token 2d2e2a334c5f36e7a7c43b46e_ +## Changelog -`todo:setting language {language}` (default: en) -Example: _todo:setting language nl_ +View [CHANGELOG.md](https://github.com/moranje/alfred-workflow-todoist/blob/master/CHANGELOG.md) -`todo:setting items {max list items}` (default: 9) -Example: _todo:setting items 9_ +## Contributing -`todo:setting cache_timeout {time in seconds}` (default: 3600) -Example: _todo:setting cache_timeout 13_ +### Instructions -`todo:setting anonymous_statistics {true or false}` (default: true) -Example: _todo:setting anonymous_statistics false_ +```md +- Fork and clone the repo +- Install dependacies +- Symlink to project workflow folder -#### Token\* + git clone https://github.com/YOUR-USERNAME/alfred-worflow-todoist + npm install + npm run setup:dev +``` -Your Todoist api token, get it from Todoist Preferences => Account => API-token (should be 40 characters) +### Build -#### Language +Create a new build with -This is relevant for parsing date strings ('tomorrow @ 9pm', in `en`). Valid languages are: `en`, `da`, `pl`, `zh`, `ko`, `de`, `pt`, `ja`, `it`, `fr`, `sv`, `ru`, `es`, `nl`. +`npm run build` -#### Max Items to Show +### Run tests -This parameter limits the amount of tasks shown when using the `todo` command. Node.js is **required** for listing todos +Run Jest test suite with: -## Changelog +`npm run test` +`npm run test:prod` -View [CHANGELOG.md](https://github.com/moranje/alfred-workflow-todoist/blob/master/CHANGELOG.md) +Or run a watcher with -## License +`npm run test:watch` -The MIT License (MIT) +### Commits -Copyright (c) 2018 [Martien Oranje](https://github.com/moranje) +For commits I follow the `angular commit guidelines` and use `semantic release` to automate builds, semver version updates and changelog creation. The way to make sure this all works is to run: -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +`npm run commit` -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +Which guides you through the motions + +### Code of conduct + +[code-of-conduct.md](code-of-conduct.md) + +## License -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +[License MIT](LICENSE) © [Martien Oranje](https://github.com/moranje) diff --git a/code-of-conduct.md b/code-of-conduct.md new file mode 100644 index 00000000..4a9568ba --- /dev/null +++ b/code-of-conduct.md @@ -0,0 +1,74 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, gender identity and expression, level of experience, +nationality, personal appearance, race, religion, or sexual identity and +orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or +advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at alexjovermorales@gmail.com. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at [http://contributor-covenant.org/version/1/4][version] + +[homepage]: http://contributor-covenant.org +[version]: http://contributor-covenant.org/version/1/4/