def set_shell_user(self, args):
     config_path = config.get_settings_file()
     if not os.path.exists(config_path):
         print('No config file was found, creating one interactively')
         self.process_command(Init(), ['--host', args.host or DEFAULT_HOST],
                              False)
         args.host = None  # do not provide host for future use of arguments
    def run(self):
        """
        Create config file if it is not present.

        Catch ``KeyboardInterrupt`` and ``EOFError`` is required here for case
        when this command is run for first time and in shell mode.
        If we don't quit here, shell will continue execution and ask credentials once more.
        """

        # Hardcoded alias that created for the first user only.
        # Normal usecase is when user have single account and don't care about alias name.
        # Advanced users can rename alias.
        default_alias = 'Default'

        try:
            config_path = config.get_settings_file()
            if os.path.exists(config_path):
                print('A config file already exists at %s' % config_path)
                return
            print('If you do not have a Genestack account, you need to create one first')

            user = create_user_from_input(self.args.host, default_alias)
            config.add_user(user)  # adding first user make him default.
            print('Config file at "%s" has been created successfully' % config_path)
        except (KeyboardInterrupt, EOFError):
            sys.stdout.flush()
            sys.stderr.write('\nError: Init is not finished\n')
            exit(1)
    def run(self):
        """
        Create config file if it is not present.

        Catch ``KeyboardInterrupt`` and ``EOFError`` is required here for case
        when this command is run for first time and in shell mode.
        If we don't quit here, shell will continue execution and ask credentials once more.
        """

        # Hardcoded alias that created for the first user only.
        # Normal usecase is when user have single account and don't care about alias name.
        # Advanced users can rename alias.
        default_alias = 'Default'

        try:
            config_path = config.get_settings_file()
            if os.path.exists(config_path):
                print('A config file already exists at %s' % config_path)
                return
            print(
                'If you do not have a Genestack account, you need to create one first'
            )

            user = create_user_from_input(self.args.host, default_alias)
            config.add_user(user)  # adding first user make him default.
            print('Config file at "%s" has been created successfully' %
                  config_path)
        except (KeyboardInterrupt, EOFError):
            sys.stdout.flush()
            sys.stderr.write('\nError: Init is not finished\n')
            exit(1)
 def run(self):
     print(config.get_settings_file())
def check_config():
    config_path = config.get_settings_file()
    if not os.path.exists(config_path):
        print('You do not seem to have a config file yet. '
              'Please run `genestack-user-setup init`. Exiting')
        exit(1)
 def set_shell_user(self, args):
     config_path = config.get_settings_file()
     if not os.path.exists(config_path):
         print('No config file was found, creating one interactively')
         self.process_command(Init(), ['--host', args.host or DEFAULT_HOST], False)
         args.host = None  # do not provide host for future use of arguments
 def run(self):
     print(config.get_settings_file())
def check_config():
    config_path = config.get_settings_file()
    if not os.path.exists(config_path):
        print('You do not seem to have a config file yet. '
              'Please run `genestack-user-setup init`. Exiting')
        exit(1)