aboutsummaryrefslogtreecommitdiff
path: root/src/cli.rs
diff options
context:
space:
mode:
authorLukas Lueg <lukas.lueg@gmail.com>2017-01-13 08:15:06 +0100
committerJoe Wilm <jwilm@users.noreply.github.com>2017-01-23 09:14:01 -0800
commit64b42cd2f3f1da1d6a99dcdf90e6f7728ddca968 (patch)
tree4856f4884144e1cbba8a0fc8185b446193515430 /src/cli.rs
parentb23ed6ed4c53a6d010238643c443da6db3931a87 (diff)
downloadalacritty-64b42cd2f3f1da1d6a99dcdf90e6f7728ddca968.tar.gz
alacritty-64b42cd2f3f1da1d6a99dcdf90e6f7728ddca968.zip
Use the log-crate instead of printing to stdout
Diffstat (limited to 'src/cli.rs')
-rw-r--r--src/cli.rs13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/cli.rs b/src/cli.rs
index 8500ebab..03f9e88b 100644
--- a/src/cli.rs
+++ b/src/cli.rs
@@ -11,16 +11,19 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
+extern crate log;
use std::env;
use index::{Line, Column};
+
/// Options specified on the command line
pub struct Options {
pub print_events: bool,
pub ref_test: bool,
pub columns: Column,
pub lines: Line,
- pub title: String
+ pub title: String,
+ pub log_level: log::LogLevelFilter
}
impl Default for Options {
@@ -30,7 +33,8 @@ impl Default for Options {
ref_test: false,
columns: Column(80),
lines: Line(24),
- title: "Alacritty".to_owned()
+ title: "Alacritty".to_owned(),
+ log_level: log::LogLevelFilter::Warn,
}
}
}
@@ -56,6 +60,11 @@ impl Options {
"-t" | "--title" => {
args_iter.next().map(|t| options.title = t);
},
+ "-q" => options.log_level = log::LogLevelFilter::Error,
+ "-qq" => options.log_level = log::LogLevelFilter::Off,
+ "-v" => options.log_level = log::LogLevelFilter::Info,
+ "-vv" => options.log_level = log::LogLevelFilter::Debug,
+ "-vvv" => options.log_level = log::LogLevelFilter::Trace,
// ignore unexpected
_ => (),
}