asana-api-cli 3.0.0__tar.gz → 3.1.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- asana_api_cli-3.1.1/PKG-INFO +228 -0
- asana_api_cli-3.1.1/README.md +200 -0
- {asana_api_cli-3.0.0 → asana_api_cli-3.1.1}/pyproject.toml +8 -8
- asana_api_cli-3.1.1/src/asana_api_cli/cli.py +1431 -0
- {asana_api_cli-3.0.0 → asana_api_cli-3.1.1}/src/asana_api_cli/click_ext.py +133 -74
- asana_api_cli-3.1.1/src/asana_api_cli/formatter.py +388 -0
- {asana_api_cli-3.0.0 → asana_api_cli-3.1.1}/src/asana_api_cli/redactor.py +0 -1
- asana_api_cli-3.1.1/src/asana_api_cli/session.py +324 -0
- {asana_api_cli-3.0.0 → asana_api_cli-3.1.1}/src/asana_api_cli/structured_arg.py +34 -5
- asana_api_cli-3.1.1/src/asana_api_cli.egg-info/PKG-INFO +228 -0
- {asana_api_cli-3.0.0 → asana_api_cli-3.1.1}/src/asana_api_cli.egg-info/SOURCES.txt +1 -0
- {asana_api_cli-3.0.0 → asana_api_cli-3.1.1}/tests/test_cli.py +330 -72
- {asana_api_cli-3.0.0 → asana_api_cli-3.1.1}/tests/test_cli_invocation.py +402 -45
- {asana_api_cli-3.0.0 → asana_api_cli-3.1.1}/tests/test_cli_surface.py +0 -1
- {asana_api_cli-3.0.0 → asana_api_cli-3.1.1}/tests/test_click_ext.py +81 -55
- asana_api_cli-3.1.1/tests/test_formatter.py +881 -0
- {asana_api_cli-3.0.0 → asana_api_cli-3.1.1}/tests/test_redactor.py +1 -2
- asana_api_cli-3.1.1/tests/test_sdk_boilerplate.py +233 -0
- asana_api_cli-3.1.1/tests/test_session.py +366 -0
- {asana_api_cli-3.0.0 → asana_api_cli-3.1.1}/tests/test_structured_arg.py +45 -2
- asana_api_cli-3.0.0/PKG-INFO +0 -308
- asana_api_cli-3.0.0/README.md +0 -280
- asana_api_cli-3.0.0/src/asana_api_cli/cli.py +0 -1107
- asana_api_cli-3.0.0/src/asana_api_cli/formatter.py +0 -217
- asana_api_cli-3.0.0/src/asana_api_cli/session.py +0 -363
- asana_api_cli-3.0.0/src/asana_api_cli.egg-info/PKG-INFO +0 -308
- asana_api_cli-3.0.0/tests/test_formatter.py +0 -530
- asana_api_cli-3.0.0/tests/test_session.py +0 -404
- {asana_api_cli-3.0.0 → asana_api_cli-3.1.1}/LICENSE +0 -0
- {asana_api_cli-3.0.0 → asana_api_cli-3.1.1}/setup.cfg +0 -0
- {asana_api_cli-3.0.0 → asana_api_cli-3.1.1}/src/asana_api_cli/__init__.py +0 -0
- {asana_api_cli-3.0.0 → asana_api_cli-3.1.1}/src/asana_api_cli/version.py +0 -0
- {asana_api_cli-3.0.0 → asana_api_cli-3.1.1}/src/asana_api_cli.egg-info/dependency_links.txt +0 -0
- {asana_api_cli-3.0.0 → asana_api_cli-3.1.1}/src/asana_api_cli.egg-info/entry_points.txt +0 -0
- {asana_api_cli-3.0.0 → asana_api_cli-3.1.1}/src/asana_api_cli.egg-info/requires.txt +0 -0
- {asana_api_cli-3.0.0 → asana_api_cli-3.1.1}/src/asana_api_cli.egg-info/top_level.txt +0 -0
- {asana_api_cli-3.0.0 → asana_api_cli-3.1.1}/tests/test_py310_compat.py +0 -0
- {asana_api_cli-3.0.0 → asana_api_cli-3.1.1}/tests/test_version.py +2 -2
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: asana-api-cli
|
|
3
|
+
Version: 3.1.1
|
|
4
|
+
Summary: Command-line wrapper around the official Asana Python SDK
|
|
5
|
+
Author: Masanao Izumo
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/izumo-m/asana-api-cli
|
|
8
|
+
Project-URL: Repository, https://github.com/izumo-m/asana-api-cli
|
|
9
|
+
Project-URL: Issues, https://github.com/izumo-m/asana-api-cli/issues
|
|
10
|
+
Project-URL: Changelog, https://github.com/izumo-m/asana-api-cli/blob/main/CHANGELOG.md
|
|
11
|
+
Keywords: asana,cli,python-asana
|
|
12
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
18
|
+
Classifier: Topic :: Office/Business :: Groupware
|
|
19
|
+
Classifier: Topic :: Utilities
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: click>=8.0
|
|
24
|
+
Requires-Dist: jq>=1.6
|
|
25
|
+
Requires-Dist: tabulate>=0.9
|
|
26
|
+
Requires-Dist: asana<6,>=5.0.2
|
|
27
|
+
Dynamic: license-file
|
|
28
|
+
|
|
29
|
+
# asana-api-cli
|
|
30
|
+
|
|
31
|
+
Call any Asana endpoint from your shell — no throwaway Python script
|
|
32
|
+
needed. `asana-api <group> <command>` turns **every method of the official
|
|
33
|
+
[`python-asana`](https://github.com/Asana/python-asana) SDK** into a
|
|
34
|
+
command, so you can read, create, and inspect Asana data one line at a time.
|
|
35
|
+
|
|
36
|
+
And because each command maps 1:1 to an SDK method, the call you work out in
|
|
37
|
+
the shell is the call you write in Python:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
# Work it out interactively...
|
|
41
|
+
asana-api tasks get-tasks --project 123 --opt-fields name,assignee.name
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
```python
|
|
45
|
+
# ...then drop the same call into your app:
|
|
46
|
+
asana.TasksApi(client).get_tasks({"project": "123", "opt_fields": "name,assignee.name"})
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Why asana-api-cli
|
|
50
|
+
|
|
51
|
+
- **Explore the whole API from the shell.** Every method of every `*Api`
|
|
52
|
+
class is a command — list tasks, create a project, poll events — with no
|
|
53
|
+
script and no boilerplate.
|
|
54
|
+
- **What you learn transfers to Python.** Flags map to SDK method
|
|
55
|
+
parameters, and JSON output matches the SDK's response shape — so a
|
|
56
|
+
working shell call becomes a working SDK call. Each option's `--help`
|
|
57
|
+
even names where its value lands in the SDK.
|
|
58
|
+
- **Always matches your SDK version.** The command tree is built at startup
|
|
59
|
+
by introspecting the installed `asana` package. Install it beside your
|
|
60
|
+
project's SDK and the two stay in lock-step — new upstream methods appear
|
|
61
|
+
the moment `pip install -U asana` lands, with no `asana-api-cli` release
|
|
62
|
+
and no stale docs.
|
|
63
|
+
- **Shell-native ergonomics.** JSON / table / CSV / text output, `jq`
|
|
64
|
+
filtering (`--query`), automatic pagination, structured error envelopes,
|
|
65
|
+
and `--debug` request tracing with the auth token masked.
|
|
66
|
+
|
|
67
|
+
## Installation
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
pip install asana-api-cli
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
For best results, install `asana-api-cli` into the same Python environment
|
|
74
|
+
that holds your project's `python-asana` so the CLI surface tracks the
|
|
75
|
+
exact SDK version your application uses (see [As a
|
|
76
|
+
dev-dependency](#as-a-dev-dependency) below).
|
|
77
|
+
|
|
78
|
+
### As a dev-dependency
|
|
79
|
+
|
|
80
|
+
If your project already uses `python-asana`, add `asana-api-cli` to your dev
|
|
81
|
+
group so the CLI tracks the same SDK version your application code uses:
|
|
82
|
+
|
|
83
|
+
```toml
|
|
84
|
+
# pyproject.toml
|
|
85
|
+
[project]
|
|
86
|
+
dependencies = ["asana>=5.2,<6"]
|
|
87
|
+
|
|
88
|
+
[dependency-groups] # uv
|
|
89
|
+
dev = ["asana-api-cli"]
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
```toml
|
|
93
|
+
# Poetry
|
|
94
|
+
[tool.poetry.group.dev.dependencies]
|
|
95
|
+
asana-api-cli = "*"
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
After `uv sync` (or equivalent), `asana-api` resolves to the project's
|
|
99
|
+
`.venv` and introspects whatever `asana` version is locked there. Calls
|
|
100
|
+
prototyped with `asana-api tasks ...` translate directly to the SDK calls
|
|
101
|
+
you'll write in your app.
|
|
102
|
+
|
|
103
|
+
### Installing globally with pipx
|
|
104
|
+
|
|
105
|
+
If you would rather isolate `asana-api-cli` from any project's dependencies
|
|
106
|
+
— for example, when you administer Asana from the shell without writing
|
|
107
|
+
Python — install it with [pipx](https://pipx.pypa.io/):
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
pipx install asana-api-cli
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
In this setup the CLI uses the `python-asana` version pipx resolved when
|
|
114
|
+
installing `asana-api-cli`; `pipx upgrade asana-api-cli` updates only
|
|
115
|
+
`asana-api-cli` itself, not the bundled `python-asana`. To pull a newer
|
|
116
|
+
`python-asana` into the existing pipx install without reinstalling the
|
|
117
|
+
CLI:
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
pipx runpip asana-api-cli install -U asana
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
The next `asana-api` run sees the new SDK and any newly added methods
|
|
124
|
+
automatically.
|
|
125
|
+
|
|
126
|
+
## Environment variables
|
|
127
|
+
|
|
128
|
+
| Name | Required | Description |
|
|
129
|
+
|------|----------|-------------|
|
|
130
|
+
| `ASANA_ACCESS_TOKEN` | Yes (at runtime only) | Asana personal access token |
|
|
131
|
+
| `ASANA_DEFAULT_WORKSPACE` | No | Default workspace GID for endpoints that require it |
|
|
132
|
+
|
|
133
|
+
The token can be issued from the
|
|
134
|
+
[Asana Developer Console](https://app.asana.com/0/developer-console).
|
|
135
|
+
No token is needed for `--help` or argument validation errors.
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
export ASANA_ACCESS_TOKEN="2/12345..."
|
|
139
|
+
export ASANA_DEFAULT_WORKSPACE="12345678" # optional
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
On Windows PowerShell:
|
|
143
|
+
|
|
144
|
+
```powershell
|
|
145
|
+
$env:ASANA_ACCESS_TOKEN = "2/12345..."
|
|
146
|
+
$env:ASANA_DEFAULT_WORKSPACE = "12345678" # optional
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## Shell completion
|
|
150
|
+
|
|
151
|
+
`asana-api` is built with Click, which supports dynamic shell completion.
|
|
152
|
+
To enable bash completion, add the following line to your `~/.bashrc`:
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
eval "$(_ASANA_API_COMPLETE=bash_source asana-api)"
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Then reload the shell (`source ~/.bashrc` or open a new terminal). Pressing
|
|
159
|
+
`<TAB>` after `asana-api` will now complete subcommands and options.
|
|
160
|
+
|
|
161
|
+
For `zsh` or `fish`, replace `bash_source` with `zsh_source` or `fish_source`
|
|
162
|
+
and add the line to `~/.zshrc` or `~/.config/fish/config.fish` respectively.
|
|
163
|
+
|
|
164
|
+
Click does not generate PowerShell completion. Windows users can install
|
|
165
|
+
completion under WSL or Git Bash using the `bash_source` line above.
|
|
166
|
+
|
|
167
|
+
## Usage
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
# Version and help
|
|
171
|
+
asana-api --version
|
|
172
|
+
asana-api --help
|
|
173
|
+
asana-api tasks --help
|
|
174
|
+
asana-api tasks get-tasks --help
|
|
175
|
+
|
|
176
|
+
# List workspaces
|
|
177
|
+
asana-api workspaces get-workspaces
|
|
178
|
+
|
|
179
|
+
# List up to 50 projects
|
|
180
|
+
asana-api projects get-projects-for-workspace --item-limit 50
|
|
181
|
+
asana-api projects get-projects --workspace <WORKSPACE_GID> --item-limit 50
|
|
182
|
+
|
|
183
|
+
# List every task in a project (walks every page by default)
|
|
184
|
+
asana-api tasks get-tasks --project <PROJECT_GID>
|
|
185
|
+
|
|
186
|
+
# Preview the first few items
|
|
187
|
+
asana-api tasks get-tasks --project <PROJECT_GID> --item-limit 5
|
|
188
|
+
|
|
189
|
+
# One HTTP call: return the first page + the next_page cursor
|
|
190
|
+
asana-api tasks get-tasks --project <PROJECT_GID> --limit 100 --full-payload
|
|
191
|
+
|
|
192
|
+
# Single task
|
|
193
|
+
asana-api tasks get-task --task <TASK_GID>
|
|
194
|
+
|
|
195
|
+
# Create a task (body is a JSON string)
|
|
196
|
+
asana-api tasks create-task --body '{"data":{"name":"new task","projects":["<PROJECT_GID>"]}}'
|
|
197
|
+
|
|
198
|
+
# Output formats — pair non-JSON formats with `--query '.data'` to unwrap the
|
|
199
|
+
# `{"data": [...]}` envelope into one row per item.
|
|
200
|
+
asana-api tasks get-tasks --project <PROJECT_GID> --query '.data' --output table
|
|
201
|
+
asana-api tasks get-tasks --project <PROJECT_GID> --query '.data' --output csv
|
|
202
|
+
|
|
203
|
+
# CSV output is UTF-8 without a BOM by default. Pass --csv-bom for Excel on
|
|
204
|
+
# Windows, which otherwise displays non-ASCII characters as garbled text.
|
|
205
|
+
asana-api tasks get-tasks --project <PROJECT_GID> --output csv --csv-bom > tasks.csv
|
|
206
|
+
|
|
207
|
+
# --output none suppresses the success payload — handy for side-effect-only
|
|
208
|
+
# calls (delete/update) where only the exit code matters. The `--query` pass
|
|
209
|
+
# still runs, so jq syntax errors are caught even when output is silenced.
|
|
210
|
+
asana-api tasks delete-task --task <TASK_GID> --output none
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
For the complete option reference — global options, pagination, output formats,
|
|
214
|
+
workspace resolution, error handling, and exit codes — see
|
|
215
|
+
[`docs/usage.md`](https://github.com/izumo-m/asana-api-cli/blob/main/docs/usage.md).
|
|
216
|
+
|
|
217
|
+
Asana only accepts Bearer-token authentication (personal access token, Service
|
|
218
|
+
Account, or OAuth), so authenticate with `--access-token` or
|
|
219
|
+
`$ASANA_ACCESS_TOKEN`.
|
|
220
|
+
|
|
221
|
+
## Development
|
|
222
|
+
|
|
223
|
+
See [docs/development.md](https://github.com/izumo-m/asana-api-cli/blob/main/docs/development.md)
|
|
224
|
+
for building from source and project layout.
|
|
225
|
+
|
|
226
|
+
## License
|
|
227
|
+
|
|
228
|
+
[MIT License](https://github.com/izumo-m/asana-api-cli/blob/main/LICENSE)
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
# asana-api-cli
|
|
2
|
+
|
|
3
|
+
Call any Asana endpoint from your shell — no throwaway Python script
|
|
4
|
+
needed. `asana-api <group> <command>` turns **every method of the official
|
|
5
|
+
[`python-asana`](https://github.com/Asana/python-asana) SDK** into a
|
|
6
|
+
command, so you can read, create, and inspect Asana data one line at a time.
|
|
7
|
+
|
|
8
|
+
And because each command maps 1:1 to an SDK method, the call you work out in
|
|
9
|
+
the shell is the call you write in Python:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
# Work it out interactively...
|
|
13
|
+
asana-api tasks get-tasks --project 123 --opt-fields name,assignee.name
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
```python
|
|
17
|
+
# ...then drop the same call into your app:
|
|
18
|
+
asana.TasksApi(client).get_tasks({"project": "123", "opt_fields": "name,assignee.name"})
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Why asana-api-cli
|
|
22
|
+
|
|
23
|
+
- **Explore the whole API from the shell.** Every method of every `*Api`
|
|
24
|
+
class is a command — list tasks, create a project, poll events — with no
|
|
25
|
+
script and no boilerplate.
|
|
26
|
+
- **What you learn transfers to Python.** Flags map to SDK method
|
|
27
|
+
parameters, and JSON output matches the SDK's response shape — so a
|
|
28
|
+
working shell call becomes a working SDK call. Each option's `--help`
|
|
29
|
+
even names where its value lands in the SDK.
|
|
30
|
+
- **Always matches your SDK version.** The command tree is built at startup
|
|
31
|
+
by introspecting the installed `asana` package. Install it beside your
|
|
32
|
+
project's SDK and the two stay in lock-step — new upstream methods appear
|
|
33
|
+
the moment `pip install -U asana` lands, with no `asana-api-cli` release
|
|
34
|
+
and no stale docs.
|
|
35
|
+
- **Shell-native ergonomics.** JSON / table / CSV / text output, `jq`
|
|
36
|
+
filtering (`--query`), automatic pagination, structured error envelopes,
|
|
37
|
+
and `--debug` request tracing with the auth token masked.
|
|
38
|
+
|
|
39
|
+
## Installation
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
pip install asana-api-cli
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
For best results, install `asana-api-cli` into the same Python environment
|
|
46
|
+
that holds your project's `python-asana` so the CLI surface tracks the
|
|
47
|
+
exact SDK version your application uses (see [As a
|
|
48
|
+
dev-dependency](#as-a-dev-dependency) below).
|
|
49
|
+
|
|
50
|
+
### As a dev-dependency
|
|
51
|
+
|
|
52
|
+
If your project already uses `python-asana`, add `asana-api-cli` to your dev
|
|
53
|
+
group so the CLI tracks the same SDK version your application code uses:
|
|
54
|
+
|
|
55
|
+
```toml
|
|
56
|
+
# pyproject.toml
|
|
57
|
+
[project]
|
|
58
|
+
dependencies = ["asana>=5.2,<6"]
|
|
59
|
+
|
|
60
|
+
[dependency-groups] # uv
|
|
61
|
+
dev = ["asana-api-cli"]
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
```toml
|
|
65
|
+
# Poetry
|
|
66
|
+
[tool.poetry.group.dev.dependencies]
|
|
67
|
+
asana-api-cli = "*"
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
After `uv sync` (or equivalent), `asana-api` resolves to the project's
|
|
71
|
+
`.venv` and introspects whatever `asana` version is locked there. Calls
|
|
72
|
+
prototyped with `asana-api tasks ...` translate directly to the SDK calls
|
|
73
|
+
you'll write in your app.
|
|
74
|
+
|
|
75
|
+
### Installing globally with pipx
|
|
76
|
+
|
|
77
|
+
If you would rather isolate `asana-api-cli` from any project's dependencies
|
|
78
|
+
— for example, when you administer Asana from the shell without writing
|
|
79
|
+
Python — install it with [pipx](https://pipx.pypa.io/):
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
pipx install asana-api-cli
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
In this setup the CLI uses the `python-asana` version pipx resolved when
|
|
86
|
+
installing `asana-api-cli`; `pipx upgrade asana-api-cli` updates only
|
|
87
|
+
`asana-api-cli` itself, not the bundled `python-asana`. To pull a newer
|
|
88
|
+
`python-asana` into the existing pipx install without reinstalling the
|
|
89
|
+
CLI:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
pipx runpip asana-api-cli install -U asana
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
The next `asana-api` run sees the new SDK and any newly added methods
|
|
96
|
+
automatically.
|
|
97
|
+
|
|
98
|
+
## Environment variables
|
|
99
|
+
|
|
100
|
+
| Name | Required | Description |
|
|
101
|
+
|------|----------|-------------|
|
|
102
|
+
| `ASANA_ACCESS_TOKEN` | Yes (at runtime only) | Asana personal access token |
|
|
103
|
+
| `ASANA_DEFAULT_WORKSPACE` | No | Default workspace GID for endpoints that require it |
|
|
104
|
+
|
|
105
|
+
The token can be issued from the
|
|
106
|
+
[Asana Developer Console](https://app.asana.com/0/developer-console).
|
|
107
|
+
No token is needed for `--help` or argument validation errors.
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
export ASANA_ACCESS_TOKEN="2/12345..."
|
|
111
|
+
export ASANA_DEFAULT_WORKSPACE="12345678" # optional
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
On Windows PowerShell:
|
|
115
|
+
|
|
116
|
+
```powershell
|
|
117
|
+
$env:ASANA_ACCESS_TOKEN = "2/12345..."
|
|
118
|
+
$env:ASANA_DEFAULT_WORKSPACE = "12345678" # optional
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Shell completion
|
|
122
|
+
|
|
123
|
+
`asana-api` is built with Click, which supports dynamic shell completion.
|
|
124
|
+
To enable bash completion, add the following line to your `~/.bashrc`:
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
eval "$(_ASANA_API_COMPLETE=bash_source asana-api)"
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Then reload the shell (`source ~/.bashrc` or open a new terminal). Pressing
|
|
131
|
+
`<TAB>` after `asana-api` will now complete subcommands and options.
|
|
132
|
+
|
|
133
|
+
For `zsh` or `fish`, replace `bash_source` with `zsh_source` or `fish_source`
|
|
134
|
+
and add the line to `~/.zshrc` or `~/.config/fish/config.fish` respectively.
|
|
135
|
+
|
|
136
|
+
Click does not generate PowerShell completion. Windows users can install
|
|
137
|
+
completion under WSL or Git Bash using the `bash_source` line above.
|
|
138
|
+
|
|
139
|
+
## Usage
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
# Version and help
|
|
143
|
+
asana-api --version
|
|
144
|
+
asana-api --help
|
|
145
|
+
asana-api tasks --help
|
|
146
|
+
asana-api tasks get-tasks --help
|
|
147
|
+
|
|
148
|
+
# List workspaces
|
|
149
|
+
asana-api workspaces get-workspaces
|
|
150
|
+
|
|
151
|
+
# List up to 50 projects
|
|
152
|
+
asana-api projects get-projects-for-workspace --item-limit 50
|
|
153
|
+
asana-api projects get-projects --workspace <WORKSPACE_GID> --item-limit 50
|
|
154
|
+
|
|
155
|
+
# List every task in a project (walks every page by default)
|
|
156
|
+
asana-api tasks get-tasks --project <PROJECT_GID>
|
|
157
|
+
|
|
158
|
+
# Preview the first few items
|
|
159
|
+
asana-api tasks get-tasks --project <PROJECT_GID> --item-limit 5
|
|
160
|
+
|
|
161
|
+
# One HTTP call: return the first page + the next_page cursor
|
|
162
|
+
asana-api tasks get-tasks --project <PROJECT_GID> --limit 100 --full-payload
|
|
163
|
+
|
|
164
|
+
# Single task
|
|
165
|
+
asana-api tasks get-task --task <TASK_GID>
|
|
166
|
+
|
|
167
|
+
# Create a task (body is a JSON string)
|
|
168
|
+
asana-api tasks create-task --body '{"data":{"name":"new task","projects":["<PROJECT_GID>"]}}'
|
|
169
|
+
|
|
170
|
+
# Output formats — pair non-JSON formats with `--query '.data'` to unwrap the
|
|
171
|
+
# `{"data": [...]}` envelope into one row per item.
|
|
172
|
+
asana-api tasks get-tasks --project <PROJECT_GID> --query '.data' --output table
|
|
173
|
+
asana-api tasks get-tasks --project <PROJECT_GID> --query '.data' --output csv
|
|
174
|
+
|
|
175
|
+
# CSV output is UTF-8 without a BOM by default. Pass --csv-bom for Excel on
|
|
176
|
+
# Windows, which otherwise displays non-ASCII characters as garbled text.
|
|
177
|
+
asana-api tasks get-tasks --project <PROJECT_GID> --output csv --csv-bom > tasks.csv
|
|
178
|
+
|
|
179
|
+
# --output none suppresses the success payload — handy for side-effect-only
|
|
180
|
+
# calls (delete/update) where only the exit code matters. The `--query` pass
|
|
181
|
+
# still runs, so jq syntax errors are caught even when output is silenced.
|
|
182
|
+
asana-api tasks delete-task --task <TASK_GID> --output none
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
For the complete option reference — global options, pagination, output formats,
|
|
186
|
+
workspace resolution, error handling, and exit codes — see
|
|
187
|
+
[`docs/usage.md`](https://github.com/izumo-m/asana-api-cli/blob/main/docs/usage.md).
|
|
188
|
+
|
|
189
|
+
Asana only accepts Bearer-token authentication (personal access token, Service
|
|
190
|
+
Account, or OAuth), so authenticate with `--access-token` or
|
|
191
|
+
`$ASANA_ACCESS_TOKEN`.
|
|
192
|
+
|
|
193
|
+
## Development
|
|
194
|
+
|
|
195
|
+
See [docs/development.md](https://github.com/izumo-m/asana-api-cli/blob/main/docs/development.md)
|
|
196
|
+
for building from source and project layout.
|
|
197
|
+
|
|
198
|
+
## License
|
|
199
|
+
|
|
200
|
+
[MIT License](https://github.com/izumo-m/asana-api-cli/blob/main/LICENSE)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "asana-api-cli"
|
|
3
|
-
version = "3.
|
|
3
|
+
version = "3.1.1"
|
|
4
4
|
description = "Command-line wrapper around the official Asana Python SDK"
|
|
5
5
|
authors = [{name = "Masanao Izumo"}]
|
|
6
6
|
readme = "README.md"
|
|
@@ -35,13 +35,13 @@ asana-api = "asana_api_cli.cli:main"
|
|
|
35
35
|
|
|
36
36
|
[dependency-groups]
|
|
37
37
|
dev = [
|
|
38
|
-
"ruff>=0.
|
|
39
|
-
"basedpyright>=1.
|
|
38
|
+
"ruff>=0.15",
|
|
39
|
+
"basedpyright>=1.39",
|
|
40
40
|
"pytest>=9,<10",
|
|
41
|
-
"build>=1,<2",
|
|
42
|
-
"twine>=6,<7",
|
|
43
|
-
"vermin>=1.
|
|
44
|
-
"vcrpy>=
|
|
41
|
+
"build>=1.5,<2",
|
|
42
|
+
"twine>=6.2,<7",
|
|
43
|
+
"vermin>=1.8,<2",
|
|
44
|
+
"vcrpy>=8",
|
|
45
45
|
"pytest-recording>=0.13",
|
|
46
46
|
]
|
|
47
47
|
|
|
@@ -61,7 +61,7 @@ docstring-code-format = true
|
|
|
61
61
|
quote-style = "double"
|
|
62
62
|
|
|
63
63
|
[tool.ruff.lint]
|
|
64
|
-
select = ["E", "F", "W", "N", "B", "ISC", "G", "SIM", "Q"]
|
|
64
|
+
select = ["E", "F", "I", "W", "N", "B", "ISC", "G", "SIM", "Q"]
|
|
65
65
|
ignore = ["SIM102"]
|
|
66
66
|
unfixable = ["F401"] # do not auto-fix unused imports
|
|
67
67
|
|