Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions src/cli/league/season.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
pub mod conference;
pub mod playoffs;
pub mod schedule;
pub mod standings;
pub mod team;
pub mod week;

use clap::{Subcommand, Args};

use crate::cli::league::season::conference::FbsimLeagueSeasonConferenceSubcommand;
use crate::cli::league::season::playoffs::FbsimLeagueSeasonPlayoffsSubcommand;
use crate::cli::league::season::standings::FbsimLeagueSeasonStandingsArgs;
use crate::cli::league::season::team::FbsimLeagueSeasonTeamSubcommand;
use crate::cli::league::season::schedule::FbsimLeagueSeasonScheduleSubcommand;
use crate::cli::league::season::week::FbsimLeagueSeasonWeekSubcommand;
Expand Down Expand Up @@ -58,6 +62,11 @@ pub enum FbsimLeagueSeasonSubcommand {
Get(FbsimLeagueSeasonGetArgs),
List(FbsimLeagueSeasonListArgs),
Sim(FbsimLeagueSeasonSimArgs),
Standings(FbsimLeagueSeasonStandingsArgs),
Conference {
#[command(subcommand)]
command: FbsimLeagueSeasonConferenceSubcommand
},
Playoffs {
#[command(subcommand)]
command: FbsimLeagueSeasonPlayoffsSubcommand
Expand Down
64 changes: 64 additions & 0 deletions src/cli/league/season/conference.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
pub mod division;

use clap::{Subcommand, Args};

use crate::cli::league::season::conference::division::FbsimLeagueSeasonConferenceDivisionSubcommand;

/// Add a conference to the current season
#[derive(Args, Clone)]
pub struct FbsimLeagueSeasonConferenceAddArgs {
/// The input filepath for the league
#[arg(short='l')]
#[arg(long="league")]
pub league: String,

/// The name of the conference
#[arg(short='n')]
#[arg(long="name")]
pub name: String,
}

/// List conferences in a season
#[derive(Args, Clone)]
pub struct FbsimLeagueSeasonConferenceListArgs {
/// The input filepath for the league
#[arg(short='l')]
#[arg(long="league")]
pub league: String,

/// The year of the season
#[arg(short='y')]
#[arg(long="year")]
pub year: usize,
}

/// Get a conference from a season
#[derive(Args, Clone)]
pub struct FbsimLeagueSeasonConferenceGetArgs {
/// The input filepath for the league
#[arg(short='l')]
#[arg(long="league")]
pub league: String,

/// The year of the season
#[arg(short='y')]
#[arg(long="year")]
pub year: usize,

/// The conference ID
#[arg(short='c')]
#[arg(long="conference")]
pub conference: usize,
}

/// Manage conferences for a season
#[derive(Subcommand, Clone)]
pub enum FbsimLeagueSeasonConferenceSubcommand {
Add(FbsimLeagueSeasonConferenceAddArgs),
List(FbsimLeagueSeasonConferenceListArgs),
Get(FbsimLeagueSeasonConferenceGetArgs),
Division {
#[command(subcommand)]
command: FbsimLeagueSeasonConferenceDivisionSubcommand
}
}
71 changes: 71 additions & 0 deletions src/cli/league/season/conference/division.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
use clap::{Subcommand, Args};

/// Add a division to a conference
#[derive(Args, Clone)]
pub struct FbsimLeagueSeasonConferenceDivisionAddArgs {
/// The input filepath for the league
#[arg(short='l')]
#[arg(long="league")]
pub league: String,

/// The conference index
#[arg(short='c')]
#[arg(long="conference")]
pub conference: usize,

/// The name of the division
#[arg(short='n')]
#[arg(long="name")]
pub name: String,
}

/// List divisions in a conference
#[derive(Args, Clone)]
pub struct FbsimLeagueSeasonConferenceDivisionListArgs {
/// The input filepath for the league
#[arg(short='l')]
#[arg(long="league")]
pub league: String,

/// The year of the season
#[arg(short='y')]
#[arg(long="year")]
pub year: usize,

/// The conference index
#[arg(short='c')]
#[arg(long="conference")]
pub conference: usize,
}

/// Get a division from a conference
#[derive(Args, Clone)]
pub struct FbsimLeagueSeasonConferenceDivisionGetArgs {
/// The input filepath for the league
#[arg(short='l')]
#[arg(long="league")]
pub league: String,

/// The year of the season
#[arg(short='y')]
#[arg(long="year")]
pub year: usize,

/// The conference index
#[arg(short='c')]
#[arg(long="conference")]
pub conference: usize,

/// The division ID
#[arg(short='d')]
#[arg(long="division")]
pub division: usize,
}

/// Manage divisions in a conference
#[derive(Subcommand, Clone)]
pub enum FbsimLeagueSeasonConferenceDivisionSubcommand {
Add(FbsimLeagueSeasonConferenceDivisionAddArgs),
List(FbsimLeagueSeasonConferenceDivisionListArgs),
Get(FbsimLeagueSeasonConferenceDivisionGetArgs),
}
29 changes: 27 additions & 2 deletions src/cli/league/season/playoffs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,20 @@ pub struct FbsimLeagueSeasonPlayoffsGenArgs {
#[arg(long="league")]
pub league: String,

/// The number of teams in the playoffs
/// The number of teams in the playoffs (total, or per conference with -p flag)
#[arg(short='n')]
#[arg(long="num-teams")]
pub num_teams: usize,

/// Enable multi-conference playoffs, where number of teams is per-conference
#[arg(short='p')]
#[arg(long="per-conference")]
pub per_conference: bool,

/// Guarantee division winners get playoff berths
#[arg(short='d')]
#[arg(long="division-winners")]
pub division_winners: bool,
}

/// Display the playoffs for a season
Expand Down Expand Up @@ -54,11 +64,26 @@ pub struct FbsimLeagueSeasonPlayoffsPictureArgs {
#[arg(long="year")]
pub year: usize,

/// Number of playoff teams
/// Number of playoff teams (total, or per conference with -p flag)
#[arg(short='n')]
#[arg(long="num-playoff-teams")]
#[arg(default_value="4")]
pub num_playoff_teams: usize,

/// Calculate multi-conference playoff picture, where number of teams is per-conference
#[arg(short='p')]
#[arg(long="per-conference")]
pub per_conference: bool,

/// Account for division winner guaranteed berths
#[arg(short='d')]
#[arg(long="division-winners")]
pub division_winners: bool,

/// Show only this conference (optional)
#[arg(short='c')]
#[arg(long="conference")]
pub conference: Option<usize>,
}

/// Manage playoffs for a season
Expand Down
17 changes: 11 additions & 6 deletions src/cli/league/season/playoffs/round.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,20 @@ pub struct FbsimLeagueSeasonPlayoffsRoundGetArgs {
#[arg(long="year")]
pub year: usize,

/// The playoff round index
/// The playoff round ID
#[arg(short='r')]
#[arg(long="round")]
pub round: usize,

/// Get conference-specific round (optional, for multi-conference playoffs)
#[arg(short='c')]
#[arg(long="conference")]
pub conference: Option<usize>,

/// Get winners bracket round (optional, for multi-conference playoffs)
#[arg(short='w')]
#[arg(long="winners-bracket")]
pub winners_bracket: bool,
}

/// Simulate a playoff round
Expand All @@ -30,11 +40,6 @@ pub struct FbsimLeagueSeasonPlayoffsRoundSimArgs {
#[arg(short='l')]
#[arg(long="league")]
pub league: String,

/// The playoff round index
#[arg(short='r')]
#[arg(long="round")]
pub round: usize,
}

/// Manage rounds in the playoffs
Expand Down
21 changes: 21 additions & 0 deletions src/cli/league/season/playoffs/round/matchup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ pub struct FbsimLeagueSeasonPlayoffsRoundMatchupGetArgs {
#[arg(short='m')]
#[arg(long="matchup")]
pub matchup: usize,

/// The conference bracket index (optional, for conference playoffs)
#[arg(short='c')]
#[arg(long="conference")]
pub conference: Option<usize>,

/// Get a matchup from the winners bracket instead of a conference bracket
#[arg(short='w')]
#[arg(long="winners-bracket")]
pub winners_bracket: bool,
}

/// Simulate a matchup from a playoff round
Expand All @@ -46,6 +56,17 @@ pub struct FbsimLeagueSeasonPlayoffsRoundMatchupSimArgs {
#[arg(short='m')]
#[arg(long="matchup")]
pub matchup: usize,

/// The conference bracket index (defaults to 0)
#[arg(short='c')]
#[arg(long="conference")]
#[arg(default_value_t = 0)]
pub conference: usize,

/// Simulate a matchup from the winners bracket instead of a conference bracket
#[arg(short='w')]
#[arg(long="winners-bracket")]
pub winners_bracket: bool,
}

/// Manage matchups for a playoff round
Expand Down
12 changes: 12 additions & 0 deletions src/cli/league/season/schedule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,18 @@ pub struct FbsimLeagueSeasonScheduleGenArgs {
#[arg(short='p')]
#[arg(long="permute")]
pub permute: Option<bool>,

/// Number of games per division opponent
#[arg(long="division-games")]
pub division_games: Option<usize>,

/// Number of games per non-division conference opponent
#[arg(long="conference-games")]
pub conference_games: Option<usize>,

/// Total number of cross-conference games
#[arg(long="cross-conference-games")]
pub cross_conference_games: Option<usize>,
}

/// Manage the schedule for the current season of a FootballSim league
Expand Down
33 changes: 33 additions & 0 deletions src/cli/league/season/standings.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
use clap::Args;

/// Display standings for a season
#[derive(Args, Clone)]
pub struct FbsimLeagueSeasonStandingsArgs {
/// The input filepath for the league
#[arg(short='l')]
#[arg(long="league")]
pub league: String,

/// The year of the season
#[arg(short='y')]
#[arg(long="year")]
pub year: usize,

/// Filter by conference index (optional)
#[arg(short='c')]
#[arg(long="conference")]
pub conference: Option<usize>,

/// Filter by division ID (requires -c/--conference)
#[arg(short='d')]
#[arg(long="division")]
pub division: Option<usize>,

/// Group standings by conference
#[arg(long="by-conference")]
pub by_conference: bool,

/// Group standings by division
#[arg(long="by-division")]
pub by_division: bool,
}
25 changes: 25 additions & 0 deletions src/cli/league/season/team.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,30 @@ pub struct FbsimLeagueSeasonTeamAddArgs {
pub id: usize
}

/// Assign a team to a division
#[derive(Args, Clone)]
pub struct FbsimLeagueSeasonTeamAssignArgs {
/// The input filepath for the league
#[arg(short='l')]
#[arg(long="league")]
pub league: String,

/// The ID of the team to assign
#[arg(short='t')]
#[arg(long="team")]
pub team: usize,

/// The conference ID
#[arg(short='c')]
#[arg(long="conference")]
pub conference: usize,

/// The division ID
#[arg(short='d')]
#[arg(long="division")]
pub division: usize,
}

/// Display a team from a FootballSim season
#[derive(Args, Clone)]
pub struct FbsimLeagueSeasonTeamGetArgs {
Expand Down Expand Up @@ -72,6 +96,7 @@ pub struct FbsimLeagueSeasonTeamListArgs {
#[derive(Subcommand, Clone)]
pub enum FbsimLeagueSeasonTeamSubcommand {
Add(FbsimLeagueSeasonTeamAddArgs),
Assign(FbsimLeagueSeasonTeamAssignArgs),
Get(FbsimLeagueSeasonTeamGetArgs),
List(FbsimLeagueSeasonTeamListArgs),
Stats {
Expand Down
Loading