1790
1790
class cmd_whoami(Command):
1791
"""Show bzr user id."""
1792
takes_options = ['email']
1791
"""Show or set bzr user id.
1795
bzr whoami 'Frank Chu <fchu@example.com>'
1797
takes_options = [ Option('email',
1798
help='display email address only'),
1800
help='set identity for the current branch instead of '
1803
takes_args = ['name?']
1804
encoding_type = 'replace'
1794
1806
@display_command
1795
def run(self, email=False):
1797
c = WorkingTree.open_containing(u'.')[0].branch.get_config()
1798
except NotBranchError:
1807
def run(self, email=False, branch=False, name=None):
1809
# use branch if we're inside one; otherwise global config
1811
c = Branch.open_containing('.')[0].get_config()
1812
except NotBranchError:
1813
c = config.GlobalConfig()
1815
self.outf.write(c.user_email() + '\n')
1817
self.outf.write(c.username() + '\n')
1820
# use global config unless --branch given
1822
c = Branch.open_containing('.')[0].get_config()
1799
1824
c = config.GlobalConfig()
1801
print c.user_email()
1825
c.set_user_option('email', name)
1806
1828
class cmd_nick(Command):