mirror of
https://github.com/figsoda/mmtc
synced 2025-02-16 21:38:38 +00:00
migrate from nightly to stable rust
This commit is contained in:
parent
37fc4dc30a
commit
0bf8e6e110
8 changed files with 95 additions and 73 deletions
6
.github/workflows/ci.yml
vendored
6
.github/workflows/ci.yml
vendored
|
@ -28,7 +28,7 @@ jobs:
|
|||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: nightly
|
||||
toolchain: stable
|
||||
target: ${{ matrix.target }}
|
||||
override: true
|
||||
|
||||
|
@ -49,7 +49,7 @@ jobs:
|
|||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: nightly
|
||||
toolchain: stable
|
||||
components: clippy
|
||||
override: true
|
||||
|
||||
|
@ -70,7 +70,7 @@ jobs:
|
|||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: nightly
|
||||
toolchain: stable
|
||||
components: rustfmt
|
||||
override: true
|
||||
|
||||
|
|
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
|
@ -61,6 +61,8 @@ jobs:
|
|||
with:
|
||||
command: build
|
||||
args: --release --target ${{ matrix.target }}
|
||||
env:
|
||||
RUSTFLAGS: -Z strip=symbols
|
||||
|
||||
- name: Upload release asset
|
||||
uses: actions/upload-release-asset@v1
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
cargo-features = ["strip"]
|
||||
|
||||
[package]
|
||||
name = "mmtc"
|
||||
version = "0.2.8"
|
||||
|
@ -35,4 +33,3 @@ features = ["crossterm", "serde"]
|
|||
lto = true
|
||||
panic = "abort"
|
||||
codegen-units = 1
|
||||
strip = "symbols"
|
||||
|
|
|
@ -20,19 +20,16 @@ Minimal [mpd](https://github.com/musicplayerdaemon/mpd) terminal client that aim
|
|||
The latest precompiled binaries are available on [github](https://github.com/figsoda/mmtc/releases/latest).
|
||||
|
||||
Alternatively you can install mmtc from [crates.io][Crate] with cargo.
|
||||
This requires the nightly toolchain of [Rust].
|
||||
|
||||
```sh
|
||||
cargo +nightly install mmtc
|
||||
cargo install mmtc
|
||||
```
|
||||
|
||||
|
||||
## Building from source
|
||||
|
||||
This requires the nightly toolchain of [Rust].
|
||||
|
||||
```sh
|
||||
cargo +nightly build --release
|
||||
cargo build --release
|
||||
```
|
||||
|
||||
|
||||
|
@ -101,4 +98,3 @@ See [CHANGELOG.md]
|
|||
[Crate]: https://crates.io/crates/mmtc
|
||||
[Configuration.md]: Configuration.md
|
||||
[CHANGELOG.md]: CHANGELOG.md
|
||||
[Rust]: https://www.rust-lang.org/tools/install
|
||||
|
|
|
@ -214,7 +214,7 @@ impl<'de> Deserialize<'de> for Texts {
|
|||
.ok_or_else(|| de::Error::invalid_length(0, &self))?,
|
||||
sa.next_element()?.map_or_else(
|
||||
|| Err(de::Error::invalid_length(1, &self)),
|
||||
|x| Ok(box x),
|
||||
|x| Ok(Box::new(x)),
|
||||
)?,
|
||||
sa.next_element()?.map(Box::new),
|
||||
))
|
||||
|
|
128
src/defaults.rs
128
src/defaults.rs
|
@ -53,28 +53,28 @@ pub fn layout() -> Widget {
|
|||
12,
|
||||
Widget::Textbox(Texts::Styled(
|
||||
vec![AddStyle::Fg(Color::Indexed(122)), AddStyle::Bold],
|
||||
box Texts::Text(String::from("Title")),
|
||||
Box::new(Texts::Text(String::from("Title"))),
|
||||
)),
|
||||
),
|
||||
Constrained::Ratio(
|
||||
10,
|
||||
Widget::Textbox(Texts::Styled(
|
||||
vec![AddStyle::Fg(Color::Indexed(158)), AddStyle::Bold],
|
||||
box Texts::Text(String::from("Artist")),
|
||||
Box::new(Texts::Text(String::from("Artist"))),
|
||||
)),
|
||||
),
|
||||
Constrained::Ratio(
|
||||
10,
|
||||
Widget::Textbox(Texts::Styled(
|
||||
vec![AddStyle::Fg(Color::Indexed(194)), AddStyle::Bold],
|
||||
box Texts::Text(String::from("Album")),
|
||||
Box::new(Texts::Text(String::from("Album"))),
|
||||
)),
|
||||
),
|
||||
Constrained::Ratio(
|
||||
1,
|
||||
Widget::Textbox(Texts::Styled(
|
||||
vec![AddStyle::Fg(Color::Indexed(230)), AddStyle::Bold],
|
||||
box Texts::Text(String::from("Time")),
|
||||
Box::new(Texts::Text(String::from("Time"))),
|
||||
)),
|
||||
),
|
||||
]),
|
||||
|
@ -87,8 +87,11 @@ pub fn layout() -> Widget {
|
|||
12,
|
||||
Texts::If(
|
||||
Condition::QueueCurrent,
|
||||
box Texts::Styled(vec![AddStyle::Italic], box Texts::QueueTitle),
|
||||
Some(box Texts::QueueTitle),
|
||||
Box::new(Texts::Styled(
|
||||
vec![AddStyle::Italic],
|
||||
Box::new(Texts::QueueTitle),
|
||||
)),
|
||||
Some(Box::new(Texts::QueueTitle)),
|
||||
),
|
||||
),
|
||||
style: vec![AddStyle::Fg(Color::Indexed(75))],
|
||||
|
@ -103,8 +106,11 @@ pub fn layout() -> Widget {
|
|||
10,
|
||||
Texts::If(
|
||||
Condition::QueueCurrent,
|
||||
box Texts::Styled(vec![AddStyle::Italic], box Texts::QueueArtist),
|
||||
Some(box Texts::QueueArtist),
|
||||
Box::new(Texts::Styled(
|
||||
vec![AddStyle::Italic],
|
||||
Box::new(Texts::QueueArtist),
|
||||
)),
|
||||
Some(Box::new(Texts::QueueArtist)),
|
||||
),
|
||||
),
|
||||
style: vec![AddStyle::Fg(Color::Indexed(111))],
|
||||
|
@ -119,8 +125,11 @@ pub fn layout() -> Widget {
|
|||
10,
|
||||
Texts::If(
|
||||
Condition::QueueCurrent,
|
||||
box Texts::Styled(vec![AddStyle::Italic], box Texts::QueueAlbum),
|
||||
Some(box Texts::QueueAlbum),
|
||||
Box::new(Texts::Styled(
|
||||
vec![AddStyle::Italic],
|
||||
Box::new(Texts::QueueAlbum),
|
||||
)),
|
||||
Some(Box::new(Texts::QueueAlbum)),
|
||||
),
|
||||
),
|
||||
style: vec![AddStyle::Fg(Color::Indexed(147))],
|
||||
|
@ -135,8 +144,11 @@ pub fn layout() -> Widget {
|
|||
1,
|
||||
Texts::If(
|
||||
Condition::QueueCurrent,
|
||||
box Texts::Styled(vec![AddStyle::Italic], box Texts::QueueDuration),
|
||||
Some(box Texts::QueueDuration),
|
||||
Box::new(Texts::Styled(
|
||||
vec![AddStyle::Italic],
|
||||
Box::new(Texts::QueueDuration),
|
||||
)),
|
||||
Some(Box::new(Texts::QueueDuration)),
|
||||
),
|
||||
),
|
||||
style: vec![AddStyle::Fg(Color::Indexed(183))],
|
||||
|
@ -155,108 +167,122 @@ pub fn layout() -> Widget {
|
|||
0,
|
||||
Widget::Textbox(Texts::Styled(
|
||||
vec![AddStyle::Bold],
|
||||
box Texts::If(
|
||||
Box::new(Texts::If(
|
||||
Condition::Searching,
|
||||
box Texts::Parts(vec![
|
||||
Box::new(Texts::Parts(vec![
|
||||
Texts::Styled(
|
||||
vec![AddStyle::Fg(Color::Indexed(113))],
|
||||
box Texts::Text(String::from("Searching: ")),
|
||||
Box::new(Texts::Text(String::from("Searching: "))),
|
||||
),
|
||||
Texts::Styled(
|
||||
vec![AddStyle::Fg(Color::Indexed(185))],
|
||||
box Texts::Query,
|
||||
Box::new(Texts::Query),
|
||||
),
|
||||
]),
|
||||
Some(box Texts::If(
|
||||
Condition::Not(box Condition::Stopped),
|
||||
box Texts::Parts(vec![
|
||||
])),
|
||||
Some(Box::new(Texts::If(
|
||||
Condition::Not(Box::new(Condition::Stopped)),
|
||||
Box::new(Texts::Parts(vec![
|
||||
Texts::Styled(
|
||||
vec![AddStyle::Fg(Color::Indexed(113))],
|
||||
box Texts::Parts(vec![
|
||||
Box::new(Texts::Parts(vec![
|
||||
Texts::If(
|
||||
Condition::Playing,
|
||||
box Texts::Text(String::from("[playing: ")),
|
||||
Some(box Texts::Text(String::from("[paused: "))),
|
||||
Box::new(Texts::Text(String::from("[playing: "))),
|
||||
Some(Box::new(Texts::Text(String::from(
|
||||
"[paused: ",
|
||||
)))),
|
||||
),
|
||||
Texts::CurrentElapsed,
|
||||
Texts::Text(String::from("/")),
|
||||
Texts::CurrentDuration,
|
||||
Texts::Text(String::from("] ")),
|
||||
]),
|
||||
])),
|
||||
),
|
||||
Texts::If(
|
||||
Condition::TitleExist,
|
||||
box Texts::Parts(vec![
|
||||
Box::new(Texts::Parts(vec![
|
||||
Texts::Styled(
|
||||
vec![AddStyle::Fg(Color::Indexed(149))],
|
||||
box Texts::CurrentTitle,
|
||||
Box::new(Texts::CurrentTitle),
|
||||
),
|
||||
Texts::If(
|
||||
Condition::ArtistExist,
|
||||
box Texts::Parts(vec![
|
||||
Box::new(Texts::Parts(vec![
|
||||
Texts::Styled(
|
||||
vec![AddStyle::Fg(Color::Indexed(216))],
|
||||
box Texts::Text(String::from(" ◆ ")),
|
||||
Box::new(Texts::Text(String::from(" ◆ "))),
|
||||
),
|
||||
Texts::Styled(
|
||||
vec![AddStyle::Fg(Color::Indexed(185))],
|
||||
box Texts::CurrentArtist,
|
||||
Box::new(Texts::CurrentArtist),
|
||||
),
|
||||
Texts::If(
|
||||
Condition::AlbumExist,
|
||||
box Texts::Parts(vec![
|
||||
Box::new(Texts::Parts(vec![
|
||||
Texts::Styled(
|
||||
vec![AddStyle::Fg(Color::Indexed(
|
||||
216,
|
||||
))],
|
||||
box Texts::Text(String::from(
|
||||
" ◆ ",
|
||||
Box::new(Texts::Text(
|
||||
String::from(" ◆ "),
|
||||
)),
|
||||
),
|
||||
Texts::Styled(
|
||||
vec![AddStyle::Fg(Color::Indexed(
|
||||
221,
|
||||
))],
|
||||
box Texts::CurrentAlbum,
|
||||
Box::new(Texts::CurrentAlbum),
|
||||
),
|
||||
]),
|
||||
])),
|
||||
None,
|
||||
),
|
||||
]),
|
||||
])),
|
||||
None,
|
||||
),
|
||||
]),
|
||||
Some(box Texts::Styled(
|
||||
])),
|
||||
Some(Box::new(Texts::Styled(
|
||||
vec![AddStyle::Fg(Color::Indexed(185))],
|
||||
box Texts::CurrentFile,
|
||||
)),
|
||||
Box::new(Texts::CurrentFile),
|
||||
))),
|
||||
),
|
||||
]),
|
||||
])),
|
||||
None,
|
||||
)),
|
||||
),
|
||||
))),
|
||||
)),
|
||||
)),
|
||||
),
|
||||
Constrained::Fixed(
|
||||
7,
|
||||
Widget::TextboxR(Texts::Styled(
|
||||
vec![AddStyle::Fg(Color::Indexed(81))],
|
||||
box Texts::Parts(vec![
|
||||
Box::new(Texts::Parts(vec![
|
||||
Texts::Text(String::from("[")),
|
||||
Texts::If(Condition::Repeat, box Texts::Text(String::from("@")), None),
|
||||
Texts::If(Condition::Random, box Texts::Text(String::from("#")), None),
|
||||
Texts::If(
|
||||
Condition::Repeat,
|
||||
Box::new(Texts::Text(String::from("@"))),
|
||||
None,
|
||||
),
|
||||
Texts::If(
|
||||
Condition::Random,
|
||||
Box::new(Texts::Text(String::from("#"))),
|
||||
None,
|
||||
),
|
||||
Texts::If(
|
||||
Condition::Single,
|
||||
box Texts::Text(String::from("^")),
|
||||
Some(box Texts::If(
|
||||
Box::new(Texts::Text(String::from("^"))),
|
||||
Some(Box::new(Texts::If(
|
||||
Condition::Oneshot,
|
||||
box Texts::Text(String::from("!")),
|
||||
Box::new(Texts::Text(String::from("!"))),
|
||||
None,
|
||||
)),
|
||||
))),
|
||||
),
|
||||
Texts::If(
|
||||
Condition::Consume,
|
||||
Box::new(Texts::Text(String::from("*"))),
|
||||
None,
|
||||
),
|
||||
Texts::If(Condition::Consume, box Texts::Text(String::from("*")), None),
|
||||
Texts::Text(String::from("]")),
|
||||
]),
|
||||
])),
|
||||
)),
|
||||
),
|
||||
]),
|
||||
|
|
|
@ -372,7 +372,7 @@ fn _flatten<'a>(spans: &mut Vec<Span<'a>>, xs: &'a Texts, s: &FlattenState<'a, '
|
|||
Texts::Query => {
|
||||
spans.push(Span::styled(String::from(s.query), *s.style));
|
||||
}
|
||||
Texts::Styled(styles, box xs) => {
|
||||
Texts::Styled(styles, xs) => {
|
||||
_flatten(
|
||||
spans,
|
||||
xs,
|
||||
|
@ -387,7 +387,7 @@ fn _flatten<'a>(spans: &mut Vec<Span<'a>>, xs: &'a Texts, s: &FlattenState<'a, '
|
|||
_flatten(spans, xs, s);
|
||||
}
|
||||
}
|
||||
Texts::If(cond, box xs, Some(box ys)) => {
|
||||
Texts::If(cond, xs, Some(ys)) => {
|
||||
_flatten(
|
||||
spans,
|
||||
if eval_cond(
|
||||
|
@ -408,7 +408,7 @@ fn _flatten<'a>(spans: &mut Vec<Span<'a>>, xs: &'a Texts, s: &FlattenState<'a, '
|
|||
s,
|
||||
);
|
||||
}
|
||||
Texts::If(cond, box xs, None) => {
|
||||
Texts::If(cond, xs, None) => {
|
||||
if eval_cond(
|
||||
cond,
|
||||
&ConditionState {
|
||||
|
@ -518,9 +518,9 @@ fn eval_cond(cond: &Condition, s: &ConditionState) -> bool {
|
|||
Condition::Selected => s.selected,
|
||||
Condition::Searching => s.searching,
|
||||
Condition::Filtered => !s.query.is_empty(),
|
||||
Condition::Not(box x) => !eval_cond(x, s),
|
||||
Condition::And(box x, box y) => eval_cond(x, s) && eval_cond(y, s),
|
||||
Condition::Or(box x, box y) => eval_cond(x, s) || eval_cond(y, s),
|
||||
Condition::Xor(box x, box y) => eval_cond(x, s) ^ eval_cond(y, s),
|
||||
Condition::Not(x) => !eval_cond(x, s),
|
||||
Condition::And(x, y) => eval_cond(x, s) && eval_cond(y, s),
|
||||
Condition::Or(x, y) => eval_cond(x, s) || eval_cond(y, s),
|
||||
Condition::Xor(x, y) => eval_cond(x, s) ^ eval_cond(y, s),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#![allow(clippy::too_many_arguments)]
|
||||
#![feature(box_patterns, box_syntax, destructuring_assignment)]
|
||||
#![forbid(unsafe_code)]
|
||||
|
||||
mod app;
|
||||
|
@ -478,7 +477,9 @@ async fn run() -> Result<()> {
|
|||
|
||||
// conditionally update queue
|
||||
if updates & 0b010 == 0b010 {
|
||||
(s.queue, queue_strings) = cl.queue(s.status.queue_len, &cfg.search_fields).await?;
|
||||
let queue = cl.queue(s.status.queue_len, &cfg.search_fields).await?;
|
||||
s.queue = queue.0;
|
||||
queue_strings = queue.1;
|
||||
s.liststate.select(None);
|
||||
s.reselect();
|
||||
if !s.query.is_empty() {
|
||||
|
|
Loading…
Add table
Reference in a new issue