dynamist / phabfive

A command line tool to interact with Phabricator
Apache License 2.0
4 stars 2 forks source link

Implement "maniphest create" command #51

Closed Grokzen closed 1 year ago

Grokzen commented 1 year ago

Add new command maniphest create to the maniphest app

This only supports a very small subset of all available options and arguments that can be set on the ticket itself to keep things simple. No hiearchy or ticket linking posible for now, but maybe addition in the future if we really need it. For now any linking between tickets has to be done manually after the create

Example output after running the new file test-template.yaml included in the PR

image

Closes #52

Example debug logging output when doing a --dry-run

phabfive) ➜  phabfive git:(f/maniphest-bulk-import) ✗   phabfive --log-level=DEBUG maniphest create test-template.yaml --dry-run
DEBUG - phabfive.core:110 - Loading configuration defaults
DEBUG - phabfive.core:116 - Loading configuration file: /etc/phabfive.yaml
DEBUG - phabfive.core:131 - Loading configuration files: /etc/phabfive.d/*.yaml
DEBUG - phabfive.core:142 - Loading configuration file: /home/grok/.config/phabfive.yaml
DEBUG - phabfive.core:157 - Loading configuration files: /home/grok/.config/phabfive.d/*.yaml
DEBUG - phabfive.core:167 - Loading configuration from environment
DEBUG - phabfive.core:56 - PHABFIVE_DEBUG ........ False
DEBUG - phabfive.core:56 - PHAB_TOKEN ............ api-gr...
DEBUG - phabfive.core:56 - PHAB_URL .............. http://phabricator.domain.tld/api/
DEBUG - urllib3.connectionpool:228 - Starting new HTTP connection (1): phabricator.domain.tld:80
DEBUG - urllib3.connectionpool:456 - http://phabricator.domain.tld:80 "POST /api/conduit.query HTTP/1.1" 200 None
DEBUG - urllib3.connectionpool:228 - Starting new HTTP connection (1): phabricator.domain.tld:80
DEBUG - urllib3.connectionpool:456 - http://phabricator.domain.tld:80 "POST /api/user.whoami HTTP/1.1" 200 None
DEBUG - urllib3.connectionpool:228 - Starting new HTTP connection (1): phabricator.domain.tld:80
DEBUG - urllib3.connectionpool:456 - http://phabricator.domain.tld:80 "POST /api/project.search HTTP/1.1" 200 None
DEBUG - phabfive.maniphest:72 - All Phabricator project names
DEBUG - phabfive.maniphest:73 - {'Dynamist-Admin': 'PHID-PROJ-rsaqdqlqtcjlzw476okc', 'Felix': 'PHID-PROJ-5vim5vuo7ygcvw2cftm3', 'IA-Linux': 'PHID-PROJ-gcxwt3ghcjfmn3ukj2nc'}
DEBUG - phabfive.maniphest:97 - {'variables': {'foo': 123, 'bar': 456, 'asd': 789}, 'tickets': [{'title': 'Ticket numero uno {{ foo }}', 'description': 'This is the description of my ticket...\nIt is many lines of text that we want to include and work with\nJinja2 rendering of variable {{ foo }}\n', 'projects': ['Dynamist-Admin']}, {'title': 'Ticket numero two {{ bar }}', 'description': 'This is ticket number two\nIt is many lines of text that we want to include and work with\nJinja2 rendering of variable {{ bar }}\n', 'projects': ['Felix']}, {'title': 'Ticket numero three {{ asd }}', 'description': 'This is ticket number three\nIt is many lines of text that we want to include and work with\nJinja2 rendering of variable {{ asd }}\n', 'projects': ['Dynamist-Admin', 'Felix', 'IA-Linux']}]}
DEBUG - phabfive.maniphest:111 - [{'title': 'Ticket numero uno 123', 'description': 'This is the description of my ticket...\nIt is many lines of text that we want to include and work with\nJinja2 rendering of variable 123', 'projects': ['Dynamist-Admin']}, {'title': 'Ticket numero two 456', 'description': 'This is ticket number two\nIt is many lines of text that we want to include and work with\nJinja2 rendering of variable 456', 'projects': ['Felix']}, {'title': 'Ticket numero three 789', 'description': 'This is ticket number three\nIt is many lines of text that we want to include and work with\nJinja2 rendering of variable 789', 'projects': ['Dynamist-Admin', 'Felix', 'IA-Linux']}]
CRITICAL - phabfive.maniphest:125 - Running with --dry-run, tickets will NOT be commited to phabricator
DEBUG - phabfive.maniphest:146 - transactions for ticket
DEBUG - phabfive.maniphest:147 - [{'type': 'title', 'value': 'Ticket numero uno 123'}, {'type': 'description', 'value': 'This is the description of my ticket...\nIt is many lines of text that we want to include and work with\nJinja2 rendering of variable 123'}, {'type': 'priority', 'value': 'normal'}, {'type': 'projects.set', 'value': ['PHID-PROJ-rsaqdqlqtcjlzw476okc']}]
INFO - phabfive.maniphest:159 - Created ticket
DEBUG - phabfive.maniphest:146 - transactions for ticket
DEBUG - phabfive.maniphest:147 - [{'type': 'title', 'value': 'Ticket numero two 456'}, {'type': 'description', 'value': 'This is ticket number two\nIt is many lines of text that we want to include and work with\nJinja2 rendering of variable 456'}, {'type': 'priority', 'value': 'normal'}, {'type': 'projects.set', 'value': ['PHID-PROJ-5vim5vuo7ygcvw2cftm3']}]
INFO - phabfive.maniphest:159 - Created ticket
DEBUG - phabfive.maniphest:146 - transactions for ticket
DEBUG - phabfive.maniphest:147 - [{'type': 'title', 'value': 'Ticket numero three 789'}, {'type': 'description', 'value': 'This is ticket number three\nIt is many lines of text that we want to include and work with\nJinja2 rendering of variable 789'}, {'type': 'priority', 'value': 'normal'}, {'type': 'projects.set', 'value': ['PHID-PROJ-rsaqdqlqtcjlzw476okc', 'PHID-PROJ-5vim5vuo7ygcvw2cftm3', 'PHID-PROJ-gcxwt3ghcjfmn3ukj2nc']}]
INFO - phabfive.maniphest:159 - Created ticket
CRITICAL - phabfive.maniphest:164 - Running with --dry-run, no ticket details will be reported as nothing was created
naestia commented 1 year ago

LGTM