Ask the user to enter the application name.
547837
private void enterAppName(BufferedReader br) throws IOException {
        while (true) {
            printInstruction("Enter your application name: [" + getDefaultAppName() + "]");

            String appNameCandidate = br.readLine();
            if (isBlank(appNameCandidate)) {
                appName = getDefaultAppName();
                break;
            } else {
                if (isPackageNameValid(getDefaultRootPackage() + "." + appNameCandidate)) {
                    appName = appNameCandidate;
                    break;
                } else {
                    System.out.println("Oops! invalid application name. Keep it simple, no '-', etc...");
                    System.out.println("");
                    continue;
                }
            }
        }
    }
1175828
def get_app_name(self):
        
        main_activity_name = self.get_main_activity()

        app_name = self.get_element('activity', 'label', name=main_activity_name)
        if not app_name:
            app_name = self.get_element('application', 'label')

        if app_name.startswith("@"):
            res_id = int(app_name[1:], 16)
            res_parser = self.get_android_resources()

            try:
                app_name = res_parser.get_resolved_res_configs(
                    res_id,
                    ARSCResTableConfig.default_config())[0][1]
            except Exception as e:
                anconf.warning("Exception selecting app name: %s" % e)
                app_name = ""
        return app_name
281
def require_setting(self, name: str, feature: str = "this feature") -> None:
        """"""
        if not self.application.settings.get(name):
            raise Exception(
                "You must define the '%s' setting in your "
                "application to use %s" % (name, feature)
            )
554704
def enter_state(self, request, application):
        
        authorised_persons = self.get_email_persons(application)
        link, is_secret = self.get_request_email_link(application)
        emails.send_request_email(
            self.authorised_text,
            self.authorised_role,
            authorised_persons,
            application,
            link, is_secret)
230429
function prompt (next) {
    var fields = ['name', 'author', 'description', 'homepage'];
    app.prompt.override = {name: name};
    app.prompt.start();
    app.prompt.addProperties(info, fields, next);
  }
1204404
def GrantApproval(self,
                    requestor_username,
                    approval_id,
                    grantor_username,
                    cursor=None):
    """"""
    self._GrantApproval(
        requestor_username, _ApprovalIDToInt(approval_id), grantor_username,
        cursor)
370258
def format_application_name(name)
      if(name.index('.') != 0)
        name = '.' + name
      end
      return name.split(" ").join("_").downcase
    end
1176059
def name(self, value):
        """"""
        data = {
            '_set_controller_name': 'Set Name',
            'controller_name': value,
        }
        self.post(data, url=SETUP_ENDPOINT, referer=SETUP_ENDPOINT)
1150686
public function appAction() {
        $name = ucfirst($this->getFirstParamOrAsk('Enter application\'s name'));;
        FSService::makeWritable(DC::getEnvironment()->getApplicationRoot() . $name);
        $this->createCV(array(
            'name' => 'Index',
            'app'  => $name,
        ));
        $appPath = DC::getEnvironment()->getApplicationRoot() . $name . '/';
        $this->safeCreateFromTemplate($appPath . 'Views/_layout.slot', '_view_layout', array('app'=>$name));
        $this->safeCreateFromTemplate($appPath . 'config.yml', '_app_config', array('app'=>$name));
        $config = DC::getProjectConfig();
        if (!$config->has('applications/'.strtolower($name))) {
            $config->set('applications/'.strtolower($name), strtolower($name));
            $this->notify('added information to project.yml', '+ config');
            $config->save();
        }
    }
538792
def get_app_key(self):
        
        if self.app_key is None:
            if os.environ.get(self.username):
                self.app_key = os.environ.get(self.username)
            else:
                raise AppKeyError(self.username)
795573
def display_user(value, arg):
    ''' 
    '''
    if value.user == arg and arg.username != ANONYMOUS_USERNAME:
        return "You"
    else:
        return value.user.get_full_name()
369157
def ask_user(prompt: str, default: str = None) -> Optional[str]:
    
    if default is None:
        prompt += ": "
    else:
        prompt += " [" + default + "]: "
    result = input(prompt)
    return result if len(result) > 0 else default
78849
def find_ask():
    
    if hasattr(current_app, 'ask'):
        return getattr(current_app, 'ask')
    else:
        if hasattr(current_app, 'blueprints'):
            blueprints = getattr(current_app, 'blueprints')
            for blueprint_name in blueprints:
                if hasattr(blueprints[blueprint_name], 'ask'):
                    return getattr(blueprints[blueprint_name], 'ask')
681454
public String getApplicationName() {
        if (this.applicationName != null)
            return this.applicationName;
        else if (webApp != null)
            return this.webApp.getApplicationName();
        else
            return null;

    }
998805
def key(username, key, all):
    """"""
    if username and username not in current_app.config['ADMIN_USERS']:
        raise click.UsageError('User {} not an admin'.format(username))

    def create_key(admin, key):
        key = ApiKey(
            user=admin,
            key=key,
            scopes=[Scope.admin, Scope.write, Scope.read],
            text='Admin key created by alertad script',
            expire_time=None
        )
        try:
            db.get_db()  # init db on global app context
            key = key.create()
        except Exception as e:
            click.echo('ERROR: {}'.format(e))
        else:
            click.echo('{} {}'.format(key.key, key.user))

    if all:
        for admin in current_app.config['ADMIN_USERS']:
            create_key(admin, key)
    elif username:
        create_key(username, key)
    else:
        raise click.UsageError("Must set '--username' or use '--all'")
1032904
private void verifyApplicationName(String name) {
    if (name == null) {
      throw new IllegalArgumentException("Application name cannot be null");
    }
    if (name.isEmpty()) {
      throw new IllegalArgumentException("Application name length must be > 0");
    }
    String reason = null;
    char[] chars = name.toCharArray();
    char c;
    for (int i = 0; i < chars.length; i++) {
      c = chars[i];
      if (c == 0) {
        reason = "null character not allowed @" + i;
        break;
      } else if (c == '/' || c == '.' || c == ':') {
        reason = "invalid character '" + c + "'";
        break;
      } else if (c > '\u0000' && c <= '\u001f' || c >= '\u007f' && c <= '\u009F'
          || c >= '\ud800' && c <= '\uf8ff' || c >= '\ufff0' && c <= '\uffff') {
        reason = "invalid character @" + i;
        break;
      }
    }
    if (reason != null) {
      throw new IllegalArgumentException(
          "Invalid application name \"" + name + "\" caused by " + reason);
    }
  }
436612
def prompt_auth(self):
        """"""
        if self.username and self.password:
            return
        sys.stdout.write("Please insert your credentials for %s\n" % self.url.base_url)
        while not self.username:
            self.username = raw_input("Username [%s]: " % getpass.getuser())

        while not self.password:
            self.password = getpass.getpass("Password: ")