#package #client #install #documentation #basic #package-manager #please-pm-client

已删除 客户端-后端

请包管理器客户端(核心库)

0.0.0 2019年9月20日

#240#package-manager

MIT 许可证

10KB

请包管理器客户端(核心库)

此包为 Please 包管理器提供轻量级环境中的基本交互性。如果您正在寻找快速轻松使用此库的 CLI,您可能在这里找到官方实现此处


lib.rs:

关于

欢迎使用 Please 包管理器客户端的文档!此文档将提供安装、运行以及可能为此项目(从现在起命名为 please-pm-client)做出贡献所需的所有必要信息。

示例

作为库

安装官方的虚拟 test-package 并查看其信息

use please_pm_client::{get_package_info, install_package};

fn main() {
    println!(
        "NEW PACKAGE INSTALLED:\n\n{:?}",
        install_package("test-package".to_string(), false, false)
    );
    println!(
        "INFO:\n\n{:?}",
        get_package_info("test-package".to_string(), false)
    );
}

这将安装一个名为 "test-package" 的新包,只包含所需的依赖项,并将打印出花哨的输出(如果您想得到更详细的输出,请在 [install_package] 中将 is_verbose 设置为 false)。

这是一个基本的示例,它没有实现适当的包检查(仅打印调试信息 {:?})。

配置示例

基本 please.toml

[package] # Basic package metadata
name = "my-test-package" # Name of package (Not optional)
description = "This is a small test package. The name of this should be like-this" # Package description
icon = "logo.png" # The icon file
readme = "README.md" # The readme file

[dependencies]
    [dependencies.required] # Required dependencies
    node = "4.6.3"
    flask = "2.0.4"

    [dependencies.optional] # Optional dependencies that user can choose to install
    python3 = "9.4.2"

    [dependencies.build] # Build dependencies. This will not be uploaded to the api but is a shortcut for a build script
    git = "1.0.2"
    docker = "5.7.2"

[build]
build_script = "build.sh" # The bash build script (Not optional)
launch_script = "launch.sh" # The launch script that determines how it will run after building
binary_dir = "build/" # The directory where binaries are produced from build_script
binary_pattern = "a.out|my_build" # Regex parsing to get the proper files.
please.toml 说明
  • 关于 binary_pattern,请参阅此处以获取有关更复杂的二进制输出的更多信息。
  • please.toml 的唯一必需部分是 package 中的 [package] 下的 [build] 以及您的包的完整信息。

基本 please.json

{
    "package": {
        "name": "my-test-package",
        "description": "This is a small test package. The name of this should be like-this",
        "icon": "logo.png",
        "readme": "README.md"
    },
    "dependencies": {
        "optional": {
            "python3": "9.4.2"
        },
        "build": {
            "git": "1.0.2",
            "docker": "5.7.2"
        },
        "required": {
            "node": "4.6.3",
            "flask": "2.0.4"
        }
    },
    "build": {
        "build_script": "build.sh",
        "launch_script": "launch.sh",
        "binary_dir": "build/",
        "binary_pattern": "a.out|my_build"
    }
}

基本用法

安装客户端

从源代码

  1. 克隆仓库: git clone https://gitlab.com/owez/please-pm-client
  2. 使用 cargo build --release 构建包管理器
  3. 前往 please-pm-client/target/release/ 并复制名为 client-backend 的可执行文件

来自 crates.io

由于该仓库正在积极开发中,目前还没有稳定的 crates.io 发布。请按照以下 指南 从源代码进行构建。

依赖项

~235–485KB
~11K SLoC