Skip to content

Commit

Permalink
Merge branch 'main' into config-opts
Browse files Browse the repository at this point in the history
  • Loading branch information
infiniteregrets authored Nov 7, 2024
2 parents 30ce198 + 75a187c commit ab887e3
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 31 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ jobs:
if [ "${{ matrix.os }}" = "windows-latest" ];
then
7z a ../../../$s2-cli-${{ matrix.target }}.zip s2-cli.exe
7z a ../../../s2-${{ matrix.target }}.zip s2.exe
else
tar -czf ../../../$s2-cli-${{ matrix.target }}.tar.gz s2-cli
tar -czf ../../../s2-${{ matrix.target }}.tar.gz s2
fi
- name: upload artifacts
uses: actions/upload-artifact@v4
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "s2-cli"
name = "s2"
version = "0.1.0"
edition = "2021"

Expand Down
2 changes: 1 addition & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ pub enum S2ConfigError {

#[error("Failed to load config file")]
#[diagnostic(help(
"Did you run `s2-cli config set`? or use `S2_AUTH_TOKEN` environment variable."
"Did you run `s2 config set`? or use `S2_AUTH_TOKEN` environment variable."
))]
LoadError(#[from] config::ConfigError),

Expand Down
52 changes: 26 additions & 26 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ const STYLES: styling::Styles = styling::Styles::styled()

const GENERAL_USAGE: &str = color_print::cstr!(
r#"
<dim>$</dim> <bold>s2-cli config set --auth-token ...</bold>
<dim>$</dim> <bold>s2-cli account list-basins --prefix "bar" --start-after "foo" --limit 100</bold>
<dim>$</dim> <bold>s2 config set --auth-token ...</bold>
<dim>$</dim> <bold>s2 account list-basins --prefix "bar" --start-after "foo" --limit 100</bold>
"#
);

Expand Down Expand Up @@ -107,13 +107,13 @@ enum ConfigActions {
#[deny(missing_docs)]
#[derive(Subcommand, Debug)]
enum AccountActions {
/// List basins
/// List basins.
ListBasins {
/// List basin names that begin with this prefix.
/// Filter to basin names that begin with this prefix.
#[arg(short, long, default_value = "")]
prefix: Option<String>,

/// List basins names that lexicographically start after this name.
/// Filter to basin names that lexicographically start after this name.
#[arg(short, long, default_value = "")]
start_after: Option<String>,

Expand All @@ -122,30 +122,30 @@ enum AccountActions {
limit: Option<usize>,
},

/// Create a basin
/// Create a basin.
CreateBasin {
/// Basin name, which must be globally unique.
/// Name of the basin to create.
basin: String,

#[command(flatten)]
config: BasinConfig,
},

/// Delete a basin
/// Delete a basin.
DeleteBasin {
/// Basin name to delete.
/// Name of the basin to delete.
basin: String,
},

/// Get basin config
/// Get basin config.
GetBasinConfig {
/// Basin name to get config for.
basin: String,
},

/// Reconfigure a basin
/// Reconfigure a basin.
ReconfigureBasin {
/// Basin name to reconfigure.
/// Name of the basin to reconfigure.
basin: String,

/// Configuration to apply.
Expand All @@ -156,13 +156,13 @@ enum AccountActions {

#[derive(Subcommand, Debug)]
enum BasinActions {
/// List Streams
/// List streams.
ListStreams {
/// List stream names that begin with this prefix.
/// Filter to stream names that begin with this prefix.
#[arg(short, long)]
prefix: Option<String>,

/// List stream names that lexicographically start after this name.
/// Filter to stream names that lexicographically start after this name.
#[arg(short, long)]
start_after: Option<String>,

Expand All @@ -171,7 +171,7 @@ enum BasinActions {
limit: Option<usize>,
},

/// Create a stream
/// Create a stream.
CreateStream {
/// Name of the stream to create.
stream: String,
Expand All @@ -181,19 +181,19 @@ enum BasinActions {
config: Option<StreamConfig>,
},

/// Delete a stream
/// Delete a stream.
DeleteStream {
/// Name of the stream to delete.
stream: String,
},

/// Get stream config
/// Get stream config.
GetStreamConfig {
/// Name of the stream to get config for.
stream: String,
},

/// Reconfigure a stream
/// Reconfigure a stream.
ReconfigureStream {
/// Name of the stream to reconfigure.
stream: String,
Expand All @@ -209,7 +209,7 @@ enum StreamActions {
/// Get the next sequence number that will be assigned by a stream.
CheckTail,

/// Append records to a stream, currently only supports newline delimited records.
/// Append records to a stream. Currently, only newline delimited records are supported.
Append {
/// Newline delimited records to append from a file or stdin (all records are treated as plain text).
/// Use "-" to read from stdin.
Expand Down Expand Up @@ -317,7 +317,7 @@ async fn run() -> Result<(), S2CliError> {
};

create_config(&config_path, new_config)?;
eprintln!("{}", "✓ Confg set successfully".green().bold());
eprintln!("{}", "✓ Confg updated successfully".green().bold());
eprintln!(" Saved to: {}", config_path.display().to_string().cyan());
}
},
Expand Down Expand Up @@ -365,12 +365,12 @@ async fn run() -> Result<(), S2CliError> {
.create_basin(basin, storage_class, retention_policy)
.await?;

eprintln!("{}", "✓ Basin created successfully".green().bold());
eprintln!("{}", "✓ Basin created".green().bold());
}

AccountActions::DeleteBasin { basin } => {
account_service.delete_basin(basin).await?;
eprintln!("{}", "✓ Basin deleted successfully".green().bold());
eprintln!("{}", "✓ Basin deletion requested".green().bold());
}

AccountActions::GetBasinConfig { basin } => {
Expand Down Expand Up @@ -424,15 +424,15 @@ async fn run() -> Result<(), S2CliError> {
BasinService::new(basin_client)
.create_stream(stream, config.map(Into::into))
.await?;
eprintln!("{}", "✓ Stream created successfully".green().bold());
eprintln!("{}", "✓ Stream created".green().bold());
}

BasinActions::DeleteStream { stream } => {
let basin_client = BasinClient::connect(client_config, basin).await?;
BasinService::new(basin_client)
.delete_stream(stream)
.await?;
eprintln!("{}", "✓ Stream deleted successfully".green().bold());
eprintln!("{}", "✓ Stream deleted".green().bold());
}

BasinActions::GetStreamConfig { stream } => {
Expand Down Expand Up @@ -460,7 +460,7 @@ async fn run() -> Result<(), S2CliError> {
.reconfigure_stream(stream, config.into(), mask)
.await?;

eprintln!("{}", "✓ Stream reconfigured successfully".green().bold());
eprintln!("{}", "✓ Stream reconfigured".green().bold());
}
}
}
Expand Down

0 comments on commit ab887e3

Please sign in to comment.