Skip to content

Commit e10ae3b

Browse files
committed
Add rust-argeparse library
1 parent 256be23 commit e10ae3b

37 files changed

+3309
-3
lines changed

meson.build

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@ project('refivar', 'rust',
22
version : '0.1',
33
default_options : ['warning_level=3'])
44

5-
#static_library('efivar', 'efivar.rs', rust_crate_type: 'staticlib', install : true)
6-
#shared_library('efivar', 'efivar.rs', rust_crate_type: 'cdylib', install : true)
5+
6+
# Third-party libraries
7+
tp_r_lib_argparse = subproject('rust-argparse-v0.2.2_p20181221').get_variable('tp_r_lib_rust_argparse')
78

89
r_lib_efivar = static_library('efivar', 'src/lib/efivar/mod.rs', rust_crate_type: 'lib', install: false)
9-
#executable('refivar_test', 'src/bin/test.rs', link_with: [r_lib_efivar], install: true)
10+
#a_lib_efivar = static_library('efivar', 'efivar.rs', rust_crate_type: 'staticlib', install : true)
11+
#so_lib_efivar = shared_library('efivar', 'efivar.rs', rust_crate_type: 'cdylib', install : true)
12+
13+
executable('efivar', 'src/bin/efivar.rs', link_with: [r_lib_efivar, tp_r_lib_argparse], install: true)

src/bin/efivar.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
extern crate efivar;
2+
extern crate argparse;
3+
4+
use argparse::{ArgumentParser, StoreTrue, StoreFalse};
5+
use std::process::ExitCode;
6+
7+
fn main() -> ExitCode {
8+
let mut verbose = false;
9+
let mut parser = ArgumentParser::new();
10+
11+
parser.refer(&mut verbose)
12+
.add_option(&["-v", "--verbose"], StoreTrue, "Be verbose")
13+
.add_option(&["-q", "--quiet"], StoreFalse, "Be quiet");
14+
15+
match parser.parse_args() {
16+
Ok(()) => {
17+
std::process::ExitCode::from(0)
18+
}
19+
Err(x) => {
20+
std::process::ExitCode::from(x as u8)
21+
}
22+
}
23+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/.vagga
2+
*.o
3+
*.so
4+
*.rlib
5+
/argparse_test
6+
/target
7+
# examples
8+
/greeting
9+
/structure
10+
/subcommands
11+
12+
# Cargo files
13+
Cargo.lock
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
sudo: false
2+
dist: trusty
3+
language: rust
4+
5+
cache:
6+
- cargo
7+
8+
before_cache:
9+
- rm -r $TRAVIS_BUILD_DIR/target/debug
10+
11+
jobs:
12+
include:
13+
- os: linux
14+
rust: stable
15+
- os: linux
16+
rust: beta
17+
- os: linux
18+
rust: nightly
19+
20+
# deploy
21+
- stage: publish
22+
os: linux
23+
rust: stable
24+
env:
25+
# CARGO_TOKEN
26+
- secure: "tk6bJEv46YfZwAKYzxn9+afzEb6nGym9lo/YJgjYIolv2qsNyMLlmC8ptRSRTHwOQPd3c54Y9XYP+61miMmWjppQSjJ4yvkUqnyiYzzdxzVM5dNIbXcqO6GbTgE2rIx9BOH0c/qrmw1KW2iz8TChxgQu/vv8pmDL1kmyawVy3EE="
27+
install: true
28+
script: true
29+
30+
deploy:
31+
- provider: script
32+
script: 'cargo publish --verbose --token=$CARGO_TOKEN'
33+
on:
34+
tags: true
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[package]
2+
3+
name = "argparse"
4+
description = "Powerful command-line argument parsing library"
5+
license = "MIT"
6+
readme = "README.rst"
7+
keywords = ["command-line", "cli", "command", "argument"]
8+
categories = ["command-line-interface"]
9+
homepage = "https://github.com/tailhook/rust-argparse"
10+
version = "0.2.2"
11+
authors = ["Paul Colomiets <paul@colomiets.name>"]
12+
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2014-2015 Paul Colomiets
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in
11+
all copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19+
THE SOFTWARE.

0 commit comments

Comments
 (0)