Bläddra i källkod

Wrap at column 79; add more examples

Matthew Wang 11 år sedan
förälder
incheckning
c456c8d42b
1 ändrade filer med 35 tillägg och 18 borttagningar
  1. 35
    18
      README.rst

+ 35
- 18
README.rst Visa fil

5
    :target: https://travis-ci.org/ymattw/cdiff
5
    :target: https://travis-ci.org/ymattw/cdiff
6
    :alt: Build status
6
    :alt: Build status
7
 
7
 
8
-Term based tool to view **colored**, **incremental** diff in *Git/Mercurial/Svn*
9
-workspace or from stdin, with **side by side** and **auto pager** support.
10
-Requires python (>= 2.5.0) and ``less``.
8
+Term based tool to view *colored*, *incremental* diff in a *Git/Mercurial/Svn*
9
+workspace or from stdin, with *side by side* and *auto pager* support. Requires
10
+python (>= 2.5.0) and ``less``.
11
 
11
 
12
 .. image:: http://ymattw.github.com/cdiff/img/default.png
12
 .. image:: http://ymattw.github.com/cdiff/img/default.png
13
    :alt: default
13
    :alt: default
28
 install with ``pip`` if you have the tool.
28
 install with ``pip`` if you have the tool.
29
 
29
 
30
 .. code:: sh
30
 .. code:: sh
31
- 
31
+
32
     pip install --upgrade cdiff
32
     pip install --upgrade cdiff
33
 
33
 
34
 Install with setup.py
34
 Install with setup.py
51
 
51
 
52
 .. code:: sh
52
 .. code:: sh
53
 
53
 
54
-    curl -ksS https://raw.github.com/ymattw/cdiff/master/cdiff.py > ~/bin/cdiff
54
+    curl https://raw.github.com/ymattw/cdiff/master/cdiff.py > ~/bin/cdiff
55
     chmod +x ~/bin/cdiff
55
     chmod +x ~/bin/cdiff
56
 
56
 
57
 Usage
57
 Usage
58
 -----
58
 -----
59
 
59
 
60
-Show usage:
60
+Type ``cdiff -h`` to show usage:
61
 
61
 
62
-.. code:: sh
62
+.. code::
63
+
64
+    $ cdiff -h
65
+    Usage: cdiff [options] [file|dir ...]
63
 
66
 
64
-    cdiff -h
67
+    View colored, incremental diff in a workspace or from stdin, with side by side
68
+    and auto pager support
69
+
70
+    Options:
71
+      --version           show program's version number and exit
72
+      -h, --help          show this help message and exit
73
+      -s, --side-by-side  enable side-by-side mode
74
+      -w N, --width=N     set text width for side-by-side mode, default is 80
75
+      -l, --log           show log with changes from revision control
76
+      -c X, --color=X     colorize mode 'auto' (default), 'always', or 'never'
65
 
77
 
66
 Read diff from local modification in a *Git/Mercurial/Svn* workspace:
78
 Read diff from local modification in a *Git/Mercurial/Svn* workspace:
67
 
79
 
79
 .. code:: sh
91
 .. code:: sh
80
 
92
 
81
     cd proj-workspace
93
     cd proj-workspace
82
-    cdiff -l
83
-    cdiff -ls                   # equivalent to cdiff -l -s
84
-    cdiff -ls -w90
94
+    cdiff -l                    # read log along with changes
95
+    cdiff -ls                   # equivalent to cdiff -l -s, view side by side
96
+    cdiff -ls -w90              # set text width 90 as well
85
     cdiff -ls file1 dir2        # see log with changes of given files/dirs only
97
     cdiff -ls file1 dir2        # see log with changes of given files/dirs only
86
 
98
 
87
 Pipe in a diff:
99
 Pipe in a diff:
88
 
100
 
89
 .. code:: sh
101
 .. code:: sh
90
 
102
 
91
-    git log -p -2 | cdiff -s    # view git log with changes of last 2 commits
92
-    git show 15bfa | cdiff -s   # view a git commit
103
+    git log -p -2 | cdiff       # view git log with changes of last 2 commits
104
+    git show 15bfa | cdiff -s   # view a given git commit, side by side
93
     svn diff -r1234 | cdiff -s  # view svn diff comparing to given revision
105
     svn diff -r1234 | cdiff -s  # view svn diff comparing to given revision
94
-    diff -u foo bar | cdiff     # pipe in diff between two files (note the '-u')
95
-    diff -ur dir1 dir2 | cdiff  # pipe in diff between two dirs
96
-    cat foo.patch | cdiff       # or cdiff < foo.path to view a unified patch
106
+    diff -u file1 file2 | cdiff # view diff between two files (note the '-u')
107
+    diff -ur dir1 dir2 | cdiff  # view diff between two dirs
108
+    cat foo.patch | cdiff       # view a unified patch (or cdiff < foo.path)
109
+
110
+    # View a GitHub pull request, side by side (GitHub web interface is missing
111
+    # this feature :)
112
+    #
113
+    curl https://github.com/ymattw/cdiff/pull/11.diff | cdiff -s
97
 
114
 
98
 Redirect output to another patch file is safe:
115
 Redirect output to another patch file is safe:
99
 
116
 
111
 - Terminal might be in a mess on exception (type ``reset`` can fix it)
128
 - Terminal might be in a mess on exception (type ``reset`` can fix it)
112
 
129
 
113
 Pull requests are very welcome, please make sure your changes can pass unit
130
 Pull requests are very welcome, please make sure your changes can pass unit
114
-tests and regression tests by run ``make test`` (required tool *coverage* can be
115
-installed with ``pip install coverage``).  Also watch out `travis build
131
+tests and regression tests by run ``make test`` (required tool *coverage* can
132
+be installed with ``pip install coverage``).  Also watch out `travis build
116
 <https://travis-ci.org/ymattw/cdiff>`_ after push, make sure it passes as well.
133
 <https://travis-ci.org/ymattw/cdiff>`_ after push, make sure it passes as well.
117
 
134
 
118
 See also
135
 See also