Skip to content

Commit 5b61457

Browse files
committed
refactor(run,readme): removed unnecessary codes, fix typos
1 parent 95a5c5d commit 5b61457

File tree

2 files changed

+1
-14
lines changed

2 files changed

+1
-14
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<img src="https://github.com/pwnwriter/rustycli/blob/images/rustycli-crop.gif" width="300" style="border-radius: 50%;">
44
</a>
55

6-
<h4><strong><code>rustycli</code></strong> — 🦀 Access the rust playground right in terminal 🍥</h4>
6+
<h4><strong><code>rustycli</code></strong> — 🦀 Access the rust playground right in your terminal 🍥</h4>
77

88

99
<a href="https://crates.io/crates/rustycli/"><img src="https://img.shields.io/crates/v/rustycli?style=flat&amp;labelColor=56534b&amp;color=c1c1b6&amp;logo=Rust&amp;logoColor=white" alt="Crate Release"></a>

src/interface/run.rs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ struct ResponsePayload {
2828

2929
// Implementation of RequestPayload with a constructor function for easy creation
3030
impl RequestPayload {
31-
// Constructor function to create a new RequestPayload instance
32-
// Takes a code string as input, and uses CLI arguments to populate other fields
3331
fn new(code: &str) -> RequestPayload {
3432
let cli = Cli::parse();
3533
RequestPayload {
@@ -56,34 +54,23 @@ pub async fn run_rustycli() -> Result<(), Box<dyn std::error::Error>> {
5654

5755
let client = Client::new();
5856

59-
// Build the POST request with the playground URL, headers, and serialized JSON payload
6057
let request_builder = client
6158
.post(PLAYGROUND_URL)
6259
.header(CONTENT_TYPE, "application/json")
6360
.json(&request_payload);
6461

65-
// Get a string representation of the request and print it
66-
// let request_str = format!("{:#?}", request_builder);
67-
// println!("{:?}", request_str);
68-
69-
// Make the HTTP request to the playground and await the response
7062
let resp_json = request_builder
7163
.send()
7264
.await?
7365
.json::<ResponsePayload>()
7466
.await?;
7567

76-
// println!("{:?}", resp_json);
77-
78-
// Display the output of the executed code (if any) or show an error message
79-
8068
let match_result = match (resp_json.stdout, resp_json.stderr) {
8169
(Some(stdout), _) if !stdout.is_empty() => stdout,
8270
(_, Some(stderr)) => stderr,
8371
_ => String::from("Error: No stdout or stderr found in the response."),
8472
};
8573

8674
spinner.success(&match_result);
87-
// println!("{}", match_result);
8875
Ok(())
8976
}

0 commit comments

Comments
 (0)