跳到主要内容

Install Lebesgue Utility

Lebesgue Utility (LBG Utility) or Lebesgue Command Line Interface (LBG CLI) is a command-line interactive tool for resource management, job management, project monitoring, and other functions.

This article introduces the invocation method of Lebesgue Utility 1.x version. Compared with versions below 1.0, the new version has the following improvements:

  • More complete documentation, all instructions can be added with -h to view usage instructions;

  • Improve the API call part, the API part is separately named lbgcore, allowing developers to call it themselves;

  • Table output supports multiple formats such as table, yaml, json, and csv;

  • All outputs can use -q or --quite to display only the id, making it convenient for embedded commands.


Quick Start

Uninstall the old version

Enter in the terminal:

pip uninstall -y lbg LebesgueUtility

Install the latest version

Enter in the terminal:

pip install lbg 

If the installation is slow, please try using the tsinghua source:

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple/ lbg

Upgrade

Enter in the terminal:

pip install -U lbg 

If the upgrade is slow, please try using the tsinghua source:

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple/ -U lbg

First Time Use

Configure Account Information

LBG CLI stores this information in a credential file named ~/.lbg/lbg_cli_context.json (a set of settings). By default, when you run a LBG CLI command without explicitly specifying the configuration file to use, the information in this configuration file will be used.

lbg config account

The following example shows example values. Replace them with your own values as described in the following sections. (Note: The password will not be displayed in the input box)

email current: [1234567890@email.com]: 1234567890@email.com
password current: [*******7890]: 1234567890

Set the default output format, the default is table, supports table, json, csv, yaml (optional):

lbg config format <output_format>

All parameter outputs can override the default output by specifying the format

ParameterAbbreviationDescriptionRequired
--csv-Output in csv formatNo
--json-Output in json formatNo
--yaml-Output in yaml formatNo
--table-Output in table formatNo
--noheader-Do not display header information, effective when the output format is table or csvNo

Set the update check level, the default is minor, supports major, minor, patch, ignore (optional):

lbg config version <version_level>

Set command autocompletion

You can achieve lbg terminal auto-completion by adding the following command to your rc file

ZSH

Copy the following command to ~/.zshrc, then enter source ~/.zshrc in the terminal

autoload -U bashcompinit
bashcompinit
eval "$(register-python-argcomplete lbg)"

BASH

Copy the following command to ~/.bashrc, then enter source ~/.bashrc in the terminal

eval "$(register-python-argcomplete lbg)"