1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
extern crate rustyline;
#[macro_use] extern crate log;
extern crate clap;
extern crate libc;
extern crate errno;
extern crate regex;
extern crate nix;
extern crate base64;
use std::io;
use std::num;
pub mod busybox;
pub mod ffi;
pub mod shell;
pub use shell::{Shell, Toolbox};
pub use shell::{Command, NativeCommand, ForeignCommand};
pub type Result = std::result::Result<(), Error>;
pub type Arguments = Vec<String>;
#[derive(Debug)]
pub enum Error {
Args(clap::Error),
Io(io::Error),
Errno(errno::Errno),
InvalidNum(std::num::ParseIntError),
InvalidRegex(regex::Error),
}
impl From<clap::Error> for Error {
fn from(err: clap::Error) -> Error {
Error::Args(err)
}
}
impl From<io::Error> for Error {
fn from(err: io::Error) -> Error {
Error::Io(err)
}
}
impl From<num::ParseIntError> for Error {
fn from(err: num::ParseIntError) -> Error {
Error::InvalidNum(err)
}
}
impl From<regex::Error> for Error {
fn from(err: regex::Error) -> Error {
Error::InvalidRegex(err)
}
}