Merge lp:~mthaddon/codetree/help-more-helpful into lp:codetree

Proposed by Tom Haddon
Status: Merged
Approved by: Tom Haddon
Approved revision: 124
Merged at revision: 124
Proposed branch: lp:~mthaddon/codetree/help-more-helpful
Merge into: lp:codetree
Diff against target: 100 lines (+42/-33)
2 files modified
README.md (+1/-30)
codetree/cli.py (+41/-3)
To merge this branch: bzr merge lp:~mthaddon/codetree/help-more-helpful
Reviewer Review Type Date Requested Status
Haw Loeung +1 Approve
Canonical IS Reviewers Pending
Review via email: mp+397555@code.launchpad.net

Commit message

Move details of configuration format into --help command to make it more user-accessible

To post a comment you must log in.
124. By Tom Haddon

Minor formatting update

Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

This merge proposal is being monitored by mergebot. Change the status to Approved to merge.

Revision history for this message
Haw Loeung (hloeung) wrote :

LGTM

review: Approve (+1)
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

Change successfully merged at revision 124

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'README.md'
2--- README.md 2021-02-05 09:12:52 +0000
3+++ README.md 2021-02-05 09:41:32 +0000
4@@ -13,36 +13,7 @@
5
6 [Config-manager](https://launchpad.net/config-manager) configuration files should be compatible with codetree. Codetree has a few more features, and therefore some additional config syntax.
7
8-Configuration files consist of directives, one per line, consisting of a local destination and a source. Blank lines and lines whose first character is "#" are ignored.
9-
10-Here's an example config:
11-
12- app lp:myapp;lightweight=true
13- app/plugins/woohoo lp:myapp-woohoo;revno=44
14- app/images/logo.gif http://content.internal/myimage.gif;overwrite=true
15- app/downloads @
16- app/content /home/contentbot/appcontent;method=link
17- app/mytag git://github.com/myapp;revno=mytag
18- app2 git+ssh://git@github.com/me/app2.git
19- app3 git+https://github.com/me/my3rdapp.git
20- app4 git+lp:~owner/project/+git/branch
21- app5 git+lp:~owner/project;revno=mytag
22- mycharm cs:trusty/mycharm
23- othercharm cs:trusty/othercharm;channel=edge,overwrite=true
24-
25-Taking that line-by-line:
26-
27-* the app directory contains a copy of the latest version of myapp, a bzr repo hosted on launchpad.net. Since "lightweight" is specified a lightweight checkout will be used rather than the default branching behavior.
28-* the app/plugins/woohoo directory contains revision number 44 of lp:myapp-woohoo
29-* app/image/logo.gif is a single image file. If it exists it will be overwritten.
30-* app/downloads is an empty directory
31-* app/content is a symlink of the local directory /home/contentbot/appcontent.
32-* app/mytag is a git checkout of the git repository from github at the tag 'mytag'
33-* app2 is also a git checkout but using a different format for the git url
34-* app3 is another git checkout but using the https style git url understood by codetree
35-* app4 is a git checkout from ssh://git.launchpad.net/~owner/project/+git/branch
36-* app5 is a git checkout of the mytag branch from ssh://git.launchpad.net/~owner/project/+git/project (if the project and repository name match, Launchpad allows it to be shortened in this way).
37-* mycharm is a Juju charm from the [charm store](https://jujucharms.com/)
38+See `codetree --help` for details of the configuration file format.
39
40 ### Source URLs
41
42
43=== modified file 'codetree/cli.py'
44--- codetree/cli.py 2020-01-30 22:08:26 +0000
45+++ codetree/cli.py 2021-02-05 09:41:32 +0000
46@@ -1,13 +1,51 @@
47 from __future__ import division, print_function
48-from argparse import ArgumentParser
49+from argparse import ArgumentParser, RawTextHelpFormatter
50 import logging
51 from .config import Config
52 import sys
53
54
55 def main():
56- ap = ArgumentParser()
57- ap.add_argument("cfgfile", nargs="+", help="Codetree configuration file")
58+ ap = ArgumentParser(formatter_class=RawTextHelpFormatter)
59+ cfgfile_help = """Codetree configuration file.
60+
61+Configuration files consist of directives, one per line, consisting of a local
62+destination and a source. Blank lines and lines whose first character is "#"
63+are ignored.
64+
65+Here's an example config:
66+
67+ app lp:myapp;lightweight=true
68+ app/plugins/woohoo lp:myapp-woohoo;revno=44
69+ app/images/logo.gif http://content.internal/myimage.gif;overwrite=true
70+ app/downloads @
71+ app/content /home/contentbot/appcontent;method=link
72+ app/mytag git://github.com/myapp;revno=mytag
73+ app2 git+ssh://git@github.com/me/app2.git
74+ app3 git+https://github.com/me/my3rdapp.git
75+ app4 git+lp:~owner/project/+git/branch
76+ app5 git+lp:~owner/project;revno=mytag
77+ mycharm cs:trusty/mycharm
78+ othercharm cs:trusty/othercharm;channel=edge,overwrite=true
79+
80+Taking that line-by-line:
81+
82+* the app directory contains a copy of the latest version of myapp, a bzr repo hosted
83+ on launchpad.net. Since "lightweight" is specified a lightweight checkout will be
84+ used rather than the default branching behavior.
85+* the app/plugins/woohoo directory contains revision number 44 of lp:myapp-woohoo.
86+* app/image/logo.gif is a single image file. If it exists it will be overwritten.
87+* app/downloads is an empty directory.
88+* app/content is a symlink of the local directory /home/contentbot/appcontent.
89+* app/mytag is a git checkout of the git repository from github at the tag 'mytag'.
90+* app2 is also a git checkout but using a different format for the git url.
91+* app3 is another git checkout but using the https style git url understood by codetree.
92+* app4 is a git checkout from ssh://git.launchpad.net/~owner/project/+git/branch.
93+* app5 is a git checkout of the mytag branch from
94+ ssh://git.launchpad.net/~owner/project/+git/project (if the project and repository
95+ name match, Launchpad allows it to be shortened in this way).
96+* mycharm is a Juju charm from the [charm store](https://jujucharms.com/)."""
97+ ap.add_argument("cfgfile", nargs="+", help=cfgfile_help)
98 ap.add_argument("-d", "--dry-run", action="store_true", default=False)
99 verbosity = ap.add_mutually_exclusive_group(required=False)
100 verbosity.add_argument("-v", "--verbose", action="store_true", default=False)

Subscribers

People subscribed via source and target branches