How to use the cli-ux.cli.action function in cli-ux

To help you get started, we’ve selected a few cli-ux 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 gkpty / super-easy-forms / testnpmpack / src / commands / email.js View on Github external
else{
                    cli.action.stop()
                  }
                })
              }
              else {
                console.error('please confirm the verification email and try again')
              }
            })
          }
          else cli.action.stop()
        }
      })
    }
    else if(flags.validate){
      cli.action.start('Validating your SES email')
      SEF.ValidateSesEmail(args.name, args.email, function(err, data){
        if(err) {
          console.error(err)
          cli.action.stop('Error')
        }
        else if(data){
          cli.action.stop()
        }
        else {
          console.error('Your email hasnt been confirmed yet.')
          cli.action.stop('Error')
        }
      })
    }
    else {
      console.error('you must either create or validate the template')
github heroku / cli / packages / oauth / src / commands / authorizations / create.ts View on Github external
async run() {
    const {flags} = this.parse(AuthorizationsCreate)

    cli.action.start('Creating OAuth Authorization')

    const {body: auth} = await this.heroku.post('/oauth/authorizations', {
      body: {
        description: flags.description,
        scope: flags.scope ? flags.scope.split(',') : undefined,
        expires_in: flags['expires-in'],
      },
    })

    cli.action.stop()

    if (flags.short) {
      cli.log(auth.access_token && auth.access_token.token)
    } else if (flags.json) {
      cli.styledJSON(auth)
    } else {
      display(auth)
    }
  }
}
github superfly / fly / packages / cli / src / commands / secrets / unset.ts View on Github external
const client = this.gqlClient(flags)
    const key = args.key

    cli.action.start("unsetting secret")

    const resp = await client.mutate({
      query: MUTATION,
      variables: {
        input: {
          appId: appName,
          keys: [key]
        }
      }
    })

    cli.action.stop()
  }
}
github superfly / fly / packages / cli / src / commands / secrets / set.ts View on Github external
const resp = await client.mutate({
      query: MUTATION,
      variables: {
        input: {
          appId: appName,
          secrets: [
            {
              key,
              value
            }
          ]
        }
      }
    })

    cli.action.stop()
  }
}
github hasura / json2graphql / src / command.js View on Github external
if (!url) {
      throw new CLIError('endpoint is required: \'json2graphql  -d ./db.js\'');
    }
    const safeUrl = this.getSafeUrl(url);
    if (!db) {
      throw new CLIError('path to sample database is required: \'json2graphql  -d ./db.js\'');
    }
    const dbJson = await this.getDbJson(db);
    const headers = {
      [secret ? 'x-hasura-admin-secret' : 'x-hasura-access-key']: secret || key,
    };
    const urlVerification = await this.verifyUrl(safeUrl, headers);
    if (urlVerification.error) {
      throw new CLIError(urlVerification.message);
    } else {
      cli.action.stop('Done!');
      await importData(dbJson, safeUrl, headers, overwrite);
    }
  }
github hasura / graphqurl / src / callbacks.js View on Github external
const queryErrorCb = (ctx, queryError, queryType) => {
  cli.action.stop('error');
  if (!queryType) {
    handleGraphQLError(queryError);
  } else if (queryType === 'subscription') {
    if (queryError.originalError) {
      const {code, path, error} = queryError.originalError;
      handleServerError(`[${code}] at [${path}]: ${error}`);
    }
  } else {
    handleServerError(queryError);
  }
};
github heroku / cli / packages / oauth / src / commands / clients / destroy.ts View on Github external
async run() {
    const {args} = this.parse(ClientsDestroy)

    cli.action.start(`Destroying ${color.cyan(args.id)}`)

    await this.heroku.delete(
      `/oauth/clients/${args.id}`,
    )

    cli.action.stop()
  }
}
github superfly / fly / packages / cli / src / commands / apps / move.ts View on Github external
const org: any = await inquirer.prompt([
        {
          name: "slug",
          message: "select an organization",
          type: "list",
          choices
        }
      ])

      const orgSlug = (org && org.slug) || ""

      if (!orgSlug) {
        throw new Error("no organization selected")
      }

      cli.action.start(`Moving app '${appName}' to organization '${orgSlug}'`)

      const resUpdate = await API.patch(`/api/v1/apps/${appName}`, {
        data: {
          attributes: {
            org_slug: orgSlug
          }
        }
      })

      processResponse(this, resUpdate, () => {
        cli.action.stop()
      })
    })
  }
github celo-org / celo-monorepo / packages / cli / src / utils / identity.ts View on Github external
protected readMetadata = () => {
    const { args } = this.parse(this.self)
    const filePath = args.file
    try {
      cli.action.start(`Read Metadata from ${filePath}`)
      const data = IdentityMetadataWrapper.fromFile(filePath)
      cli.action.stop()
      return data
    } catch (error) {
      cli.action.stop(`Error: ${error}`)
      throw error
    }
  }