~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/cmdline.py

  • Committer: Gordon Tyler
  • Date: 2010-02-02 06:30:43 UTC
  • mto: (5037.3.1 integration)
  • mto: This revision was merged to the branch mainline in revision 5046.
  • Revision ID: gordon@doxxx.net-20100202063043-3ygr1114d25m3f7m
Added cmdline.split function, which replaces commands.shlex_split_unicode.

Show diffs side-by-side

added added

removed removed

Lines of Context:
124
124
 
125
125
 
126
126
class Splitter(object):
127
 
    def __init__(self, command_line, single_quotes_allowed=False):
 
127
    def __init__(self, command_line, single_quotes_allowed):
128
128
        self.seq = _PushbackSequence(command_line)
129
129
        self.allowed_quote_chars = u'"'
130
130
        if single_quotes_allowed:
153
153
        if not self.quoted and result == '':
154
154
            result = None
155
155
        return self.quoted, result
 
156
 
 
157
def split(unsplit, single_quotes_allowed=True):
 
158
    splitter = Splitter(unsplit, single_quotes_allowed=single_quotes_allowed)
 
159
    return [arg for quoted, arg in splitter]