Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhance godbolt further #57

Merged
merged 1 commit into from
Feb 26, 2025
Merged
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
16 changes: 8 additions & 8 deletions src/commands/godbolt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,11 +252,11 @@ fn parse(args: &str) -> Result<(KeyValueArgs, String), CodeBlockError> {
tick_count += 1;
break;
}
' ' => {
' ' | '\n' => {
map.insert(take(&mut key), take(&mut value));
k = true
}
'=' => k = false,
'=' if k => k = false,
c if k => key.push(c),
c => value.push(c),
}
Expand Down Expand Up @@ -288,14 +288,14 @@ fn parse(args: &str) -> Result<(KeyValueArgs, String), CodeBlockError> {
/// Compile Rust code using <https://rust.godbolt.org>. Full optimizations are applied unless \
/// overriden.
/// ```
/// ?godbolt flag={} rustc={} ``​`
/// ?godbolt $($flags )* rustc={} ``​`
/// pub fn your_function() {
/// // Code
/// }
/// ``​`
/// ```
/// Optional arguments:
/// - `flag*`: flags to pass to rustc invocation. Defaults to {"-Copt-level=3", "--edition=2021"}
/// - `flags*`: flags to pass to rustc invocation. Defaults to ["-Copt-level=3", "--edition=2021"]
/// - `rustc`: compiler version to invoke. Defaults to `nightly`. Possible values: `nightly`, `beta` or full version like `1.45.2`
#[poise::command(prefix_command, category = "Godbolt", broadcast_typing, track_edits)]
pub async fn godbolt(ctx: Context<'_>, #[rest] arguments: String) -> Result<(), Error> {
Expand All @@ -318,14 +318,14 @@ pub async fn godbolt(ctx: Context<'_>, #[rest] arguments: String) -> Result<(),
/// Run the performance analysis tool llvm-mca using <https://rust.godbolt.org>. Full optimizations \
/// are applied unless overriden.
/// ```
/// ?mca flag={} rustc={} ``​`
/// ?mca $($flags )* rustc={} ``​`
/// pub fn your_function() {
/// // Code
/// }
/// ``​`
/// ```
/// Optional arguments:
/// - `flag*`: flags to pass to rustc invocation. Defaults to {"-Copt-level=3", "--edition=2021"}
/// - `flags*`: flags to pass to rustc invocation. Defaults to ["-Copt-level=3", "--edition=2021"]
/// - `rustc`: compiler version to invoke. Defaults to `nightly`. Possible values: `nightly`, `beta` or full version like `1.45.2`
#[poise::command(prefix_command, category = "Godbolt", broadcast_typing, track_edits)]
pub async fn mca(ctx: Context<'_>, #[rest] arguments: String) -> Result<(), Error> {
Expand All @@ -351,14 +351,14 @@ pub async fn mca(ctx: Context<'_>, #[rest] arguments: String) -> Result<(), Erro
///
/// Equivalent to ?godbolt but with extra flags `--emit=llvm-ir -Cdebuginfo=0`.
/// ```
/// ?llvmir flag={} rustc={} ``​`
/// ?llvmir $($flags )* rustc={} ``​`
/// pub fn your_function() {
/// // Code
/// }
/// ``​`
/// ```
/// Optional arguments:
/// - `flag*`: flags to pass to rustc invocation. Defaults to {"-Copt-level=3", "--edition=2021", "--emit=llvm-ir", "-Cdebuginfo=0"}
/// - `flags*`: flags to pass to rustc invocation. Defaults to ["-Copt-level=3", "--edition=2021"]
/// - `rustc`: compiler version to invoke. Defaults to `nightly`. Possible values: `nightly`, `beta` or full version like `1.45.2`
#[poise::command(prefix_command, category = "Godbolt", broadcast_typing, track_edits)]
pub async fn llvmir(ctx: Context<'_>, #[rest] arguments: String) -> Result<(), Error> {
Expand Down
Loading