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
=== modified file 'README.md'
--- README.md 2021-02-05 09:12:52 +0000
+++ README.md 2021-02-05 09:41:32 +0000
@@ -13,36 +13,7 @@
1313
14[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.14[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.
1515
16Configuration 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.16See `codetree --help` for details of the configuration file format.
17
18Here's an example config:
19
20 app lp:myapp;lightweight=true
21 app/plugins/woohoo lp:myapp-woohoo;revno=44
22 app/images/logo.gif http://content.internal/myimage.gif;overwrite=true
23 app/downloads @
24 app/content /home/contentbot/appcontent;method=link
25 app/mytag git://github.com/myapp;revno=mytag
26 app2 git+ssh://git@github.com/me/app2.git
27 app3 git+https://github.com/me/my3rdapp.git
28 app4 git+lp:~owner/project/+git/branch
29 app5 git+lp:~owner/project;revno=mytag
30 mycharm cs:trusty/mycharm
31 othercharm cs:trusty/othercharm;channel=edge,overwrite=true
32
33Taking that line-by-line:
34
35* 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.
36* the app/plugins/woohoo directory contains revision number 44 of lp:myapp-woohoo
37* app/image/logo.gif is a single image file. If it exists it will be overwritten.
38* app/downloads is an empty directory
39* app/content is a symlink of the local directory /home/contentbot/appcontent.
40* app/mytag is a git checkout of the git repository from github at the tag 'mytag'
41* app2 is also a git checkout but using a different format for the git url
42* app3 is another git checkout but using the https style git url understood by codetree
43* app4 is a git checkout from ssh://git.launchpad.net/~owner/project/+git/branch
44* 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).
45* mycharm is a Juju charm from the [charm store](https://jujucharms.com/)
4617
47### Source URLs18### Source URLs
4819
4920
=== modified file 'codetree/cli.py'
--- codetree/cli.py 2020-01-30 22:08:26 +0000
+++ codetree/cli.py 2021-02-05 09:41:32 +0000
@@ -1,13 +1,51 @@
1from __future__ import division, print_function1from __future__ import division, print_function
2from argparse import ArgumentParser2from argparse import ArgumentParser, RawTextHelpFormatter
3import logging3import logging
4from .config import Config4from .config import Config
5import sys5import sys
66
77
8def main():8def main():
9 ap = ArgumentParser()9 ap = ArgumentParser(formatter_class=RawTextHelpFormatter)
10 ap.add_argument("cfgfile", nargs="+", help="Codetree configuration file")10 cfgfile_help = """Codetree configuration file.
11
12Configuration files consist of directives, one per line, consisting of a local
13destination and a source. Blank lines and lines whose first character is "#"
14are ignored.
15
16Here's an example config:
17
18 app lp:myapp;lightweight=true
19 app/plugins/woohoo lp:myapp-woohoo;revno=44
20 app/images/logo.gif http://content.internal/myimage.gif;overwrite=true
21 app/downloads @
22 app/content /home/contentbot/appcontent;method=link
23 app/mytag git://github.com/myapp;revno=mytag
24 app2 git+ssh://git@github.com/me/app2.git
25 app3 git+https://github.com/me/my3rdapp.git
26 app4 git+lp:~owner/project/+git/branch
27 app5 git+lp:~owner/project;revno=mytag
28 mycharm cs:trusty/mycharm
29 othercharm cs:trusty/othercharm;channel=edge,overwrite=true
30
31Taking that line-by-line:
32
33* the app directory contains a copy of the latest version of myapp, a bzr repo hosted
34 on launchpad.net. Since "lightweight" is specified a lightweight checkout will be
35 used rather than the default branching behavior.
36* the app/plugins/woohoo directory contains revision number 44 of lp:myapp-woohoo.
37* app/image/logo.gif is a single image file. If it exists it will be overwritten.
38* app/downloads is an empty directory.
39* app/content is a symlink of the local directory /home/contentbot/appcontent.
40* app/mytag is a git checkout of the git repository from github at the tag 'mytag'.
41* app2 is also a git checkout but using a different format for the git url.
42* app3 is another git checkout but using the https style git url understood by codetree.
43* app4 is a git checkout from ssh://git.launchpad.net/~owner/project/+git/branch.
44* app5 is a git checkout of the mytag branch from
45 ssh://git.launchpad.net/~owner/project/+git/project (if the project and repository
46 name match, Launchpad allows it to be shortened in this way).
47* mycharm is a Juju charm from the [charm store](https://jujucharms.com/)."""
48 ap.add_argument("cfgfile", nargs="+", help=cfgfile_help)
11 ap.add_argument("-d", "--dry-run", action="store_true", default=False)49 ap.add_argument("-d", "--dry-run", action="store_true", default=False)
12 verbosity = ap.add_mutually_exclusive_group(required=False)50 verbosity = ap.add_mutually_exclusive_group(required=False)
13 verbosity.add_argument("-v", "--verbose", action="store_true", default=False)51 verbosity.add_argument("-v", "--verbose", action="store_true", default=False)

Subscribers

People subscribed via source and target branches