Skip to content

Commit

Permalink
fix(channels): list-channels in kebab-case (#195)
Browse files Browse the repository at this point in the history
```
tv gitrepos
Unknown channel: gitrepos
```

And `tv list-channels` result, before the fix:

```
tv list-channels
Builtin channels:
        env
        files
        gitrepos
        dirs
        text
        alias
```

After:

```
./target/debug/tv list-channels
Builtin channels:
        env
        files
        git-repos // HERE
        dirs
        text
        alias
```
  • Loading branch information
fannheyward authored Dec 31, 2024
1 parent 76da8b0 commit 1899873
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions crates/television-derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ fn impl_cli_channel(ast: &syn::DeriveInput) -> TokenStream {
let cli_enum = quote! {
use clap::ValueEnum;
use serde::{Deserialize, Serialize};
use strum::{Display, EnumString};
use strum::{Display, EnumIter, EnumString};
use std::default::Default;

#[derive(Debug, Clone, ValueEnum, EnumString, Default, Copy, PartialEq, Eq, Serialize, Deserialize, Display)]
#[derive(Debug, Clone, ValueEnum, EnumIter, EnumString, Default, Copy, PartialEq, Eq, Serialize, Deserialize, Display)]
#[strum(serialize_all = "kebab_case")]
pub enum CliTvChannel {
#[default]
Expand Down Expand Up @@ -115,11 +115,8 @@ fn impl_cli_channel(ast: &syn::DeriveInput) -> TokenStream {
}

pub fn all_channels() -> Vec<String> {
vec![
#(
stringify!(#cli_enum_variants).to_lowercase(),
)*
]
use strum::IntoEnumIterator;
Self::iter().map(|v| v.to_string()).collect()
}
}
};
Expand Down

0 comments on commit 1899873

Please sign in to comment.