CLI integration

Integration of Command Line Interface on Onepub.dev with Dart

OnePub CLI tooling is designed to work alongside your existing Dart CLI tooling.

When you install the OnePub CLI tooling two applications are added to your PATH.

onepub

The onepub CLI app is the primary tool you use when interacting with OnePub from the CLI.

The onepub app supports a number of commands.

You can view a full list of the commands by running:

onepub --help

To get help on an individual command run:

onepub <command> --help

onepub commands

The onepub app supports the following commands:

login

Login to a OnePub Organisation

Your email address can be associated with multiple Organisations and you use the login command to switch between them.

logout

Logout of OnePub

pub get will fail if you have a private dependency in your project.

doctor

Displays your OnePub configuration details.

Use the output of doctor when you are reporting bugs or want to check the status of OnePub.

export

Export a OnePub Token

Tokens can be used to auth in a CI/CD environement or over an SSH session.

import

Import a OnePub Token

Allows you to login when a Web browser and/or user interaction is viable such as in a CI/CD or SSH environment.

pub add [--dev]

Add a dependency on a private package.

Works the same as the dart pub add but for your own private packages.

pub private

Marks your project as a private package.

After marking your package as private you can publish it to your OnePub private repo using the standard Dart tooling.

Globally activate a private package.

If you have a private package that contains CLI tools this command installs them and adds them to your PATH.

Globally deactivate a private package.

If you have activated a global package this command will un-install it and remove it from your PATH.

opub

The opub app is used provided for users that are using versions of Dart prior to 2.15.

The Dart development team made significant changes with respect to how the Dart CLI tools interact with a private repository and older versions of the Dart pub command aren't compatible with OnePub.

To circumvent this problem OnePub provide the opub app which replaces the dart pub and flutter pub commands.

When running a command (such as dart pub get) that operates on a private package or a package that depends on a private package then you simply substitute 'dart pub get' or 'flutter pub get' with 'opub get'. The same goes for all of the pub commands.

If you are running an even older version of Dart (pre-2.12) then read the section on using Dart pre-2.12.

Last updated