Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

alpm-files

A specification, library and command line tool for the handling of Arch Linux Package Management (ALPM) files files (alpm-files).

Documentation

Examples

Library

use std::{path::PathBuf, str::FromStr};

use alpm_files::{Files, FilesV1};

fn main() -> testresult::TestResult {
let data = r#"%FILES%
usr/
usr/bin/
usr/bin/foo
"#;
let paths = vec![
  PathBuf::from("usr/"),
  PathBuf::from("usr/bin/"),
  PathBuf::from("usr/bin/foo"),
];

// Create a Files from a string.
let files_from_str = Files::V1(FilesV1::from_str(data)?);

// Create a Files from list of paths.
let files_from_paths = Files::V1(FilesV1::try_from(paths)?);

assert_eq!(files_from_str.as_ref(), files_from_paths.as_ref());
Ok(())
}

Command line interface

# Create an alpm-files file from an input directory.
alpm-files create "$ALPM_FILES_CREATE_INPUT_DIR"
# Format an alpm-files file as JSON.
alpm-files format --input-file "$ALPM_FILES_FORMAT_INPUT_FILE" --pretty
# Validate an alpm-files file.
alpm-files validate --input-file "$ALPM_FILES_VALIDATE_INPUT_FILE"

Contributing

Please refer to the contribution guidelines to learn how to contribute to this project.

License

This project can be used under the terms of the Apache-2.0 or MIT. Contributions to this project, unless noted otherwise, are automatically licensed under the terms of both of those licenses.