How to use the @twilio/cli-core.TwilioClientCommand.flags function in @twilio/cli-core

To help you get started, we’ve selected a few @twilio/cli-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github twilio / twilio-cli / src / base-commands / twilio-api-command.js View on Github external
logger.info(response ? 'The resource was deleted successfully' : 'Failed to delete the resource');
      return;
    }

    this.output(response, this.flags.properties);
  }
}

TwilioApiCommand.flags = Object.assign(
  {
    'skip-parameter-validation': flags.boolean({
      default: false,
      hidden: true
    })
  },
  TwilioClientCommand.flags
);

// A static function to help us add the other static
// fields required by oclif on our dynamically created
// command class.
TwilioApiCommand.setUpNewCommandClass = NewCommandClass => {
  const resource = NewCommandClass.actionDefinition.resource;
  const action = NewCommandClass.actionDefinition.action;
  const commandId = NewCommandClass.actionDefinition.topicName + ':' + NewCommandClass.actionDefinition.commandName;

  // Parameters
  let cmdFlags = {};
  (action.parameters || []).forEach(param => {
    const flagConfig = getFlagConfig(param, NewCommandClass.actionDefinition);
    const flagType = typeMap[param.schema.type];
github twilio / twilio-cli / src / commands / profiles / create.js View on Github external
ProfilesCreate.description = 'create a new profile to store Twilio Project credentials and configuration';

ProfilesCreate.flags = Object.assign(
  {
    'auth-token': flags.string({
      description: 'Your Twilio Auth Token for your Twilio Project.'
    }),
    force: flags.boolean({
      char: 'f',
      description: 'Force overwriting existing profile credentials.'
    }),
    region: flags.string({
      hidden: true
    })
  },
  TwilioClientCommand.flags // Yes! We _do_ want the same flags as TwilioClientCommand
);

ProfilesCreate.args = [
  {
    name: 'account-sid',
    description: 'The Account SID for your Twilio Project.'
  }
];

module.exports = ProfilesCreate;
github twilio / twilio-cli / src / commands / phone-numbers / update.js View on Github external
'voice-fallback-url': flags.string({
    description:
      'A URL that Twilio will request if an error occurs requesting or executing the TwiML defined by VoiceUrl.'
  }),
  'voice-fallback-method': flags.enum({
    options: ['GET', 'POST'],
    description: 'The HTTP method Twilio will use when requesting the VoiceFallbackUrl.'
  })
};

NumberUpdate.UrlFlags = ['smsUrl', 'smsFallbackUrl', 'voiceUrl', 'voiceFallbackUrl'];

NumberUpdate.flags = Object.assign(
  {},
  NumberUpdate.PropertyFlags,
  TwilioClientCommand.flags,
  TwilioClientCommand.accountSidFlag
);

NumberUpdate.args = [
  {
    name: 'phone-number',
    required: true,
    description: 'The SID or E.164 formatted phone number you wish to update.'
  }
];

module.exports = NumberUpdate;
github twilio-labs / plugin-serverless / src / commands / serverless / deploy.js View on Github external
let { flags, args } = this.parse(FunctionsDeploy);
    flags = normalizeFlags(flags);

    const externalOptions = createExternalCliOptions(flags, this.twilioClient);

    const opts = Object.assign({}, flags, args);
    return handler(opts, externalOptions);
  }
}

FunctionsDeploy.description = describe;

FunctionsDeploy.flags = Object.assign(
  convertYargsOptionsToOclifFlags(cliInfo.options),
  { profile: TwilioClientCommand.flags.profile }
);

module.exports = FunctionsDeploy;
github twilio-labs / plugin-serverless / src / commands / serverless / init.js View on Github external
}

FunctionsInit.description = describe;

FunctionsInit.args = [
  {
    name: 'name',
    required: true,
    description: 'Name of Serverless project and directory that will be created',
  },
];

FunctionsInit.flags = Object.assign(
  {},
  convertYargsOptionsToOclifFlags(cliInfo.options),
  { profile: TwilioClientCommand.flags.profile }
);

module.exports = FunctionsInit;
github twilio-labs / plugin-serverless / src / commands / serverless / list.js View on Github external
FunctionsList.description = describe;

FunctionsList.args = [
  {
    name: 'types',
    required: false,
    default: cliInfo.argsDefaults.types,
    description:
      'Comma separated list of things to list (services,environments,functions,assets,variables)',
  },
];

FunctionsList.flags = Object.assign(
  convertYargsOptionsToOclifFlags(cliInfo.options),
  { profile: TwilioClientCommand.flags.profile }
);

module.exports = FunctionsList;
github twilio / twilio-cli / src / commands / profiles / remove.js View on Github external
message: 'Would you like to attempt to delete the API Key?',
      default: false
    }]);
    return confirm.affirmative;
  }
}

ProfilesRemove.description = 'select which profile to remove';
ProfilesRemove.args = [
  {
    name: 'profile',
    description: 'Shorthand identifier for your profile',
    required: true
  }
];
ProfilesRemove.flags = TwilioClientCommand.flags;

module.exports = ProfilesRemove;
github twilio-labs / plugin-serverless / src / commands / serverless / activate.js View on Github external
let { flags, args } = this.parse(FunctionsActivate);
    flags = normalizeFlags(flags);

    const externalOptions = createExternalCliOptions(flags, this.twilioClient);

    const opts = Object.assign({}, flags, args);
    return handler(opts, externalOptions);
  }
}

FunctionsActivate.description = describe;

FunctionsActivate.flags = Object.assign(
  {},
  convertYargsOptionsToOclifFlags(cliInfo.options),
  { profile: TwilioClientCommand.flags.profile }
);

module.exports = FunctionsActivate;
github twilio / twilio-cli / src / commands / phone-numbers / list.js View on Github external
const fullData = await this.twilioClient.incomingPhoneNumbers.list();
    this.output(fullData, this.flags.properties);
  }
}

NumberList.description = 'show what Twilio phone numbers you have configured';

NumberList.flags = Object.assign(
  {
    properties: flags.string({
      default: 'sid, phoneNumber, friendlyName',
      description:
        'The incomingPhoneNumber object properties you would like to display (JSON output always shows all properties).'
    })
  },
  TwilioClientCommand.flags,
  TwilioClientCommand.accountSidFlag
);

module.exports = NumberList;