feat(otter): add command to create new users

main
Jef Roosens 2025-06-24 14:15:10 +02:00
parent 30609b1cef
commit c7c5cf889c
No known key found for this signature in database
GPG Key ID: 21FD3D77D56BAF49
3 changed files with 29 additions and 2 deletions

View File

@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased](https://git.rustybever.be/Chewing_Bever/otter)
* CLI command to add new users
## [0.2.1](https://git.rustybever.be/Chewing_Bever/otter/src/tag/0.2.1)
### Fixed

View File

@ -1,4 +1,4 @@
use clap::Subcommand;
use clap::{Args, Subcommand};
use super::CliError;
@ -11,6 +11,14 @@ pub enum Command {
},
/// List the devices for the given user
Devices { username: String },
#[command(subcommand)]
User(UserCommand),
}
#[derive(Subcommand)]
pub enum UserCommand {
Add { username: String, password: String },
}
impl Command {
@ -36,6 +44,21 @@ impl Command {
println!("{} ({} subscriptions)", device.id, device.subscriptions);
}
}
Self::User(user) => {
user.run(&store)?;
}
}
Ok(())
}
}
impl UserCommand {
pub fn run(&self, store: &gpodder::GpodderRepository) -> Result<(), CliError> {
match self {
Self::Add { username, password } => {
store.create_user(username, password)?;
}
}
Ok(())

View File

@ -6,7 +6,9 @@
</thead>
<tbody>
{% for user in users %}
<th>{{ user.username }}</th>
<tr>
<th>{{ user.username }}</th>
</tr>
{% endfor %}
{%- if next_page_query %}