Skip to content

Commit 4a6171d

Browse files
committed
Updated docs about comments
1 parent de52136 commit 4a6171d

File tree

2 files changed

+6
-14
lines changed

2 files changed

+6
-14
lines changed

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
* Removed ability to call commands in ``pyscript`` as if they were functions (e.g ``app.help()``) in favor
1313
of only supporting one ``pyscript`` interface. This simplifies future maintenance.
1414
* No longer supporting C-style comments. Hash (#) is the only valid comment marker.
15-
* No longer supporting comments embedded in a command. Only strings where the first non-whitespace character
16-
is a # will be treated as comments. All other # characters will be treated as literals.
15+
* No longer supporting comments embedded in a command. Only command line input where the first
16+
non-whitespace character is a # will be treated as a comment.
1717
* \# this is a comment
1818
* this # is not a comment
1919

docs/freefeatures.rst

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,13 @@ Simply include one command per line, typed exactly as you would inside a ``cmd2`
2929
Comments
3030
========
3131

32-
Comments are omitted from the argument list
33-
before it is passed to a ``do_`` method. By
34-
default, both Python-style and C-style comments
35-
are recognized. Comments can be useful in :ref:`scripts`, but would
36-
be pointless within an interactive session.
32+
Any command line input where the first non-whitespace character is a # will be treated as a comment.
33+
Comments can be useful in :ref:`scripts`, but would be pointless within an interactive session.
3734

3835
::
3936

40-
def do_speak(self, arg):
41-
self.stdout.write(arg + '\n')
42-
43-
::
44-
45-
(Cmd) speak it was /* not */ delicious! # Yuck!
46-
it was delicious!
37+
(Cmd) # this is a comment
38+
(Cmd) this # is not a comment
4739

4840
.. _arg_print: https://github.com/python-cmd2/cmd2/blob/master/examples/arg_print.py
4941

0 commit comments

Comments
 (0)