Skip to content

Commit

Permalink
helper functions whoami, about
Browse files Browse the repository at this point in the history
  • Loading branch information
mvliet committed Jan 25, 2011
1 parent c058ab1 commit 89d3051
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions repoman-client/repoman_client/subcommands/diagnostic.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
from repoman_client.subcommand import SubCommand
from repoman_client.client import RepomanClient
from repoman_client.config import config
from repoman_client import display
from repoman_client.__version__ import version
from argparse import ArgumentParser

class Whoami(SubCommand):
command_group = 'advanced'
command = 'whoami'
alias = None
description = 'Display information about the current user (ie, you)'

def get_parser(self):
p = ArgumentParser(self.description)
return p

def __call__(self, args, extra_args=None):
repo = RepomanClient(config.host, config.port, config.proxy)
me = repo.whoami()
display.display_user(me)



class About(SubCommand):
validate_config = False
command_group = 'advanced'
command = 'about'
alias = None
description = 'Display information about this program.'

def get_parser(self):
p = ArgumentParser(self.description)
return p

def __call__(self, args, extra_args=None):
keys = {'config_file':config.config_file,
'host':config.repository_host,
'port':config.repository_port,
'proxy':config.user_proxy_cert,
'snapshot':config.snapshot,
'mountpoint':config.mountpoint,
'exclude':config.exclude_dirs,
'version':version}
print """\
version: %(version)s
configuration:
config_file in use: %(config_file)s
repository_host: %(host)s
repository_port: %(port)s
user_proxy_cert: %(proxy)s
snapshot: %(snapshot)s
mountpoint: %(mountpoint)s
exclude_dirs: %(exclude)s
""" % keys

0 comments on commit 89d3051

Please sign in to comment.