blob: 32e9fab1125aa6d8eaa53a8a1e77afbac023028b (
plain)
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
|
use clap::ArgMatches;
use std::env;
use std::path::PathBuf;
pub struct Context<'a> {
pub current_dir: PathBuf,
pub arguments: ArgMatches<'a>,
}
impl<'a> Context<'a> {
pub fn new(arguments: ArgMatches) -> Context {
// TODO: Currently gets the physical directory. Get the logical directory.
let current_dir = env::current_dir().expect("Unable to identify current directory.");
Context {
current_dir,
arguments,
}
}
pub fn new_with_dir<T>(arguments: ArgMatches, dir: T) -> Context
where
T: Into<PathBuf>,
{
Context {
current_dir: dir.into(),
arguments,
}
}
}
|