npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@ibmcloud/gp-js-cli

v1.0.1

Published

Command-line client for the IBM Cloud Globalization Pipeline Service

Downloads

3

Readme

Globalization Pipeline CLI for JavaScript

The GP Command Line Interface is modelled somewhat on the GP Java CLI. This CLI was part of the g11n-pipeline package prior to [email protected]

Build Status

npm version

Coverage Status

Installation

You can use the GP CLI to perform some operations from the commandline.

$ npm install -g @ibmcloud/gp-js-cli
$ gp-js-cli -j gpconfig.json ping
true

Using npx you do not even need to install @ibmcloud/gp-js-cli to run a one-off command.

$ npx @ibmcloud/gp-js-cli -j gpconfig.json ping
true

Usage

The CLI takes one 'verb' (action) which can appear anywhere in the command line. Options have a short or a long form. Therefore, the following are all equivalent.

    g11n-pipeline -j gpconfig.json ping
    g11n-pipeline ping -j gpconfig.json
    g11n-pipeline --jsonCredentials=gpconfig.json ping
    g11n-pipeline ping --jsonCredentials=gpconfig.json

Credentials

See also the getClient() API docs Credentials may be passed in one of the following ways:

  1. Via the -j/--jsonCreds option, which takes a path to a JSON file with credentials 2a. For GP Auth: the four individual options --serviceUrl, --instanceId, --user, and --password 2b. for IAM auth via --iam_endpoint and --apikey

  2. By the following environment variables:

    • GP_URL: Service URL (e.g. https://gp-rest.ng.bluemix.net/translate/rest)
    • GP_INSTANCE_ID: Service instance ID (e.g. d3f537cd617f34c86ac6b270f3065e73)
    • if using GP Authentication:

      • GP_USER_ID: User ID (e.g. e92a1282a0e4f97bec93aa9f56fdb838)
      • GP_PASSWORD: User password (e.g. zg5SlD+ftXYRIZDblLgEA/ILkkCNqE1y)
    • if using IAM Authentication:

      • GP_IAM_API_KEY: IAM API Key
      • GP_IAM_ENDPOINT: IAM endpoint (e.g. https://iam.cloud.ibm.com)

Common Options

  • -j file.json | --jsonCredentials=file.json

    See Credentials, above.

    This option specifies a credentials file containing the GP credentials. This is a JSON file with any of the following formats:

    {"url":"≈",
     "instanceId":"≈",
     "userId":"≈",
     "password":"≈"}
    {"credentials":
       {"url":"≈",
        "instanceId":"≈",
        "userId":"≈",
        "password":"≈"}}
    {"url":"≈",
     "instanceId":"≈",
     "iam_endpoint":"≈",
     "apikey":"≈"}
    {"credentials":
       {"url":"≈",
        "instanceId":"≈",
        "iam_endpoint":"≈",
        "apikey":"≈"}}
  • --serviceUrl, --instanceId, --user, --password

    See Credentials, above. These options specify the four credential parameters individually for GP Auth.

  • --iam_endpoint, --apikey

    See Credentials, above. These options specify the two credential parameters individually for IAM Auth.

  • -F json | --outputFormat=json

    This option specifies the eventual output format of the results of the CLI operation. (API note: This formatting is applied by the filter() function. run() does not interpret this option.)

    Possible formats:

    • compact (default)

      This format causes console.dir() to be used for output. It is more compact than JSON.

    • json

      Produce JSON output.

    • none

      Don’t produce any output (besides errors).

    • line

      Output in line-by-line mode, which could be useful for processing without parsing JSON:

      • For operations that return an array (such as list), output the array one element per line.

      • For operations that return an object (such as trs), outputs the keys one element per line.

Verbs

General Commands

  • help

    Print help

  • ping

    Indicate whether the server is reachable or not.

  • info

    Prints general info about the GP service

  • instanceInfo

    Prints information specific to your service instance (such as usage)

Bundle Commands

  • list

    Return a list of bundles

  • show -b mybundle

    Show detailed information about mybundle

  • create -b mybundle -l en,es,fr

    Create bundle mybundle with source lang en and target languages es and fr. (The first language code is the source.)

  • delete -b mybundle

    Delete bundle mybundle

  • update -b mybundle -l es,fr,mt

    Update bundle mybundle to have target languages es, fr and mt

  • import -b mybundle -l en -f mybundle.json

    Import mybundle.json to replace the en language content for bundle mybundle.

    For nested structure, use the -T option to flatten the keys using the g11n-pipeline-flatten component.

  • export -b mybundle -l en -F json > mybundle.json

    Export bundle mybundle to disk as mybundle.json

    For nested structure, use the -T option to expand the keys using the g11n-pipeline-flatten component.

Translation Request Commands

  • trs

    List the Translation Requests

  • docTrs

    List the Document Translation Requests

API

The Command Line may be called from your own application code. The run() function returns a promise containing the output content. See API.md#Cli

// from a script (parse args)
const Cli = require('g11n-pipeline/lib/gpcli');
new Cli(Cli.parseArgs(process.argv)).run().then(…)

You can also preload the arguments:

const Cli = require('g11n-pipeline/lib/gpcli');
new Cli({_:['list'],jsonCreds:'creds.json'}).run().then((r) => console.dir(r));

Community

Contributing

See CONTRIBUTING.md.

License

Apache 2.0. See LICENSE.txt

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.