import sys import commands import piko from piko import utils from piko.translate import _ log = piko.getLogger('piko.cli.register') conf = piko.getConf() def __init__(): commands.register('set', execute, description=description()) def cli_options(): pass def description(): return _("Set an item in the piko configuration.") def execute(*args, **kw): """ Set an item in the piko configuration. """ conf.command_set(sys.argv[1], sys.argv[2], sys.argv[3])
# # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # import traceback import shutil import sys import codecs import locale import piko from piko.translate import _ log = piko.getLogger('piko.cli') conf = piko.getConf() class Cli(object): def __init__(self): import commands commands.__init__() to_execute = [] arg_num = 0 for arg in sys.argv[1:]: arg_num += 1 if not arg.startswith('-') and len(sys.argv) >= arg_num: if commands.commands.has_key(sys.argv[arg_num].replace(
""" piko.utils ========== Utilities for piko """ import getpass import sys import piko from piko.translate import _ # pylint: disable=invalid-name log = piko.getLogger('piko.utils') conf = piko.getConf() # pylint: disable=too-many-branches def ask_question(question, default="", password=False, confirm=False): """ Ask a question on stderr. Since the answer to the question may actually be a password, cover that case with a getpass.getpass() prompt. Accepts a default value, but ignores defaults for password prompts. .. rubric:: Usage >>> piko.utils.ask_question( "What is the server?",
import sys import commands import piko from piko import client from piko import utils from piko.translate import _ log = piko.getLogger('piko.cli.whoami') conf = piko.getConf() def __init__(): commands.register('whoami', execute, description=description()) def cli_options(): pass def description(): return _("Check whether the server believes you are you.") def execute(*args, **kw): """ Check whether the server believes you are you. """
import base64 import httplib import json import ssl import urllib from urlparse import urlparse import piko # TODO: Only enable this for development environments. # pylint: disable=protected-access ssl._create_default_https_context = ssl._create_unverified_context # pylint: disable=invalid-name log = piko.getLogger('piko.client') conf = piko.getConf() conf.parse_args() server_uri = conf.get('piko', 'server_uri') if server_uri is not None: result = urlparse(server_uri) else: result = None API_PORT = None API_SSL = None if hasattr(result, 'scheme') and result.scheme == 'https': API_PORT = 443
import sys import commands import piko from piko import client from piko import utils from piko.translate import _ log = piko.getLogger('piko.cli.account-info') conf = piko.getConf() def __init__(): commands.register('account_info', execute, description=description()) def cli_options(): pass def description(): return _("Information about your account.") def execute(*args, **kw): """ Information about your account. """