Skip to content

Commit

Permalink
Bump cursive and clap versions; releaes 0.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
toshokan committed Feb 2, 2022
1 parent e2a56b5 commit 51fd250
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion spookylock-sys/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "spookylock-sys"
version = "0.1.0"
version = "0.1.1"
authors = ["toshokan <[email protected]>"]
license = "MIT OR Apache-2.0"
edition = "2018"
Expand Down
6 changes: 3 additions & 3 deletions spookylock/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[package]
name = "spookylock"
version = "0.1.0"
version = "0.1.1"
authors = ["toshokan <[email protected]>"]
license = "MIT OR Apache-2.0"
edition = "2018"

[dependencies]
clap = { version = "3.0.0-beta.1", features = ["derive"] }
clap = { version = "^3", features = ["derive"] }
spookylock-sys = { path = "../spookylock-sys" }
termion = "1.5.4"
cursive = { version = "^0.13", features = ["termion-backend"], default-features = false }
cursive = { version = "^0.17", features = ["termion-backend"], default-features = false }
pam = "^0.7"
15 changes: 8 additions & 7 deletions spookylock/src/bin/spookylock-interface.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use clap::Clap;
use clap::Parser;
use cursive::Cursive;
use cursive::view::{Selector, Nameable, Resizable};

#[derive(Clap)]
#[derive(Parser)]
#[clap(version = env!("CARGO_PKG_VERSION"), author = env!("CARGO_PKG_AUTHORS"))]
struct Options {
#[clap(short, long)]
Expand All @@ -14,7 +15,7 @@ fn try_login(s: &mut Cursive, user: &str, pw: &str) -> Result<(), pam::PamError>
if let Ok(_) = auth.authenticate() {
s.quit()
} else {
s.call_on_id("pw", |v: &mut cursive::views::EditView| {
s.call_on(&Selector::Name("pw"), |v: &mut cursive::views::EditView| {
v.set_content("");
});
}
Expand All @@ -24,7 +25,7 @@ fn try_login(s: &mut Cursive, user: &str, pw: &str) -> Result<(), pam::PamError>
fn main() -> std::io::Result<()> {
let opts = Options::parse();

let mut siv = Cursive::termion()?;
let mut siv = cursive::termion();

let mut theme = cursive::theme::Theme::default();
let mut palette = cursive::theme::Palette::default();
Expand All @@ -39,7 +40,7 @@ fn main() -> std::io::Result<()> {

siv.set_theme(theme);

use cursive::view::{Boxable, Identifiable};
// use cursive::view::{Boxable, Identifiable};

let view = cursive::views::LinearLayout::vertical()
.child(cursive::views::DummyView)
Expand All @@ -53,14 +54,14 @@ fn main() -> std::io::Result<()> {
.on_submit(move |s, t| {
let _ = try_login(s, &opts.user, t);
})
.with_id("pw")
.with_name("pw")
.fixed_width(32),
),
);

siv.add_layer(cursive::views::Dialog::around(view).title("Locked"));
siv.add_global_callback(cursive::event::Event::CtrlChar('u'), |s: &mut Cursive| {
s.call_on_id("pw", |v: &mut cursive::views::EditView| {
s.call_on(&Selector::Name("pw"), |v: &mut cursive::views::EditView| {
v.set_content("");
});
});
Expand Down
4 changes: 2 additions & 2 deletions spookylock/src/bin/spookylock.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use clap::Clap;
use clap::Parser;
use spookylock_sys::vt;
use std::os::unix::{
io::{AsRawFd, FromRawFd, RawFd},
Expand All @@ -7,7 +7,7 @@ use std::os::unix::{
use std::path::PathBuf;
use std::process::{Command, Stdio};

#[derive(Clap)]
#[derive(Parser)]
#[clap(version = env!("CARGO_PKG_VERSION"), author = env!("CARGO_PKG_AUTHORS"))]
struct Options {
#[clap(short, long)]
Expand Down

0 comments on commit 51fd250

Please sign in to comment.