pub struct PrCreateCommand { /* private fields */ }
Expand description
Command for creating a pull request
Implementations§
Source§impl PrCreateCommand
impl PrCreateCommand
Sourcepub fn title(self, title: &str) -> Self
pub fn title(self, title: &str) -> Self
Set the PR title
Examples found in repository?
examples/pr.rs (line 10)
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4 let client = GhClient::new();
5
6 println!("Creating a pull request...");
7 match client
8 .pr()
9 .create()
10 .title("test PR created by gh_cli_rs")
11 .body("This PR adds a new feature\n\n## Changes\n- Added feature X\n- Fixed bug Y")
12 // the branches must exist in remote repo for the command to work
13 .base("main")
14 .head("feature-branch")
15 .draft()
16 .execute()
17 {
18 Ok(result) => println!("✓ PR created: {}", result),
19 Err(e) => eprintln!("✗ Error: {}", e),
20 }
21
22 println!("\n🔍 Viewing PR #1:");
23 match client.pr().view(1).execute() {
24 Ok(pr) => println!("{}", pr),
25 Err(e) => eprintln!("✗ Error: {}", e),
26 }
27
28 Ok(())
29}
Sourcepub fn body(self, body: &str) -> Self
pub fn body(self, body: &str) -> Self
Set the PR body
Examples found in repository?
examples/pr.rs (line 11)
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4 let client = GhClient::new();
5
6 println!("Creating a pull request...");
7 match client
8 .pr()
9 .create()
10 .title("test PR created by gh_cli_rs")
11 .body("This PR adds a new feature\n\n## Changes\n- Added feature X\n- Fixed bug Y")
12 // the branches must exist in remote repo for the command to work
13 .base("main")
14 .head("feature-branch")
15 .draft()
16 .execute()
17 {
18 Ok(result) => println!("✓ PR created: {}", result),
19 Err(e) => eprintln!("✗ Error: {}", e),
20 }
21
22 println!("\n🔍 Viewing PR #1:");
23 match client.pr().view(1).execute() {
24 Ok(pr) => println!("{}", pr),
25 Err(e) => eprintln!("✗ Error: {}", e),
26 }
27
28 Ok(())
29}
Sourcepub fn base(self, base: &str) -> Self
pub fn base(self, base: &str) -> Self
Set the base branch
Examples found in repository?
examples/pr.rs (line 13)
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4 let client = GhClient::new();
5
6 println!("Creating a pull request...");
7 match client
8 .pr()
9 .create()
10 .title("test PR created by gh_cli_rs")
11 .body("This PR adds a new feature\n\n## Changes\n- Added feature X\n- Fixed bug Y")
12 // the branches must exist in remote repo for the command to work
13 .base("main")
14 .head("feature-branch")
15 .draft()
16 .execute()
17 {
18 Ok(result) => println!("✓ PR created: {}", result),
19 Err(e) => eprintln!("✗ Error: {}", e),
20 }
21
22 println!("\n🔍 Viewing PR #1:");
23 match client.pr().view(1).execute() {
24 Ok(pr) => println!("{}", pr),
25 Err(e) => eprintln!("✗ Error: {}", e),
26 }
27
28 Ok(())
29}
Sourcepub fn head(self, head: &str) -> Self
pub fn head(self, head: &str) -> Self
Set the head branch
Examples found in repository?
examples/pr.rs (line 14)
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4 let client = GhClient::new();
5
6 println!("Creating a pull request...");
7 match client
8 .pr()
9 .create()
10 .title("test PR created by gh_cli_rs")
11 .body("This PR adds a new feature\n\n## Changes\n- Added feature X\n- Fixed bug Y")
12 // the branches must exist in remote repo for the command to work
13 .base("main")
14 .head("feature-branch")
15 .draft()
16 .execute()
17 {
18 Ok(result) => println!("✓ PR created: {}", result),
19 Err(e) => eprintln!("✗ Error: {}", e),
20 }
21
22 println!("\n🔍 Viewing PR #1:");
23 match client.pr().view(1).execute() {
24 Ok(pr) => println!("{}", pr),
25 Err(e) => eprintln!("✗ Error: {}", e),
26 }
27
28 Ok(())
29}
Sourcepub fn draft(self) -> Self
pub fn draft(self) -> Self
Mark as draft
Examples found in repository?
examples/pr.rs (line 15)
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4 let client = GhClient::new();
5
6 println!("Creating a pull request...");
7 match client
8 .pr()
9 .create()
10 .title("test PR created by gh_cli_rs")
11 .body("This PR adds a new feature\n\n## Changes\n- Added feature X\n- Fixed bug Y")
12 // the branches must exist in remote repo for the command to work
13 .base("main")
14 .head("feature-branch")
15 .draft()
16 .execute()
17 {
18 Ok(result) => println!("✓ PR created: {}", result),
19 Err(e) => eprintln!("✗ Error: {}", e),
20 }
21
22 println!("\n🔍 Viewing PR #1:");
23 match client.pr().view(1).execute() {
24 Ok(pr) => println!("{}", pr),
25 Err(e) => eprintln!("✗ Error: {}", e),
26 }
27
28 Ok(())
29}
Sourcepub fn execute(&self) -> Result<String>
pub fn execute(&self) -> Result<String>
Execute the create command
Examples found in repository?
examples/pr.rs (line 16)
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4 let client = GhClient::new();
5
6 println!("Creating a pull request...");
7 match client
8 .pr()
9 .create()
10 .title("test PR created by gh_cli_rs")
11 .body("This PR adds a new feature\n\n## Changes\n- Added feature X\n- Fixed bug Y")
12 // the branches must exist in remote repo for the command to work
13 .base("main")
14 .head("feature-branch")
15 .draft()
16 .execute()
17 {
18 Ok(result) => println!("✓ PR created: {}", result),
19 Err(e) => eprintln!("✗ Error: {}", e),
20 }
21
22 println!("\n🔍 Viewing PR #1:");
23 match client.pr().view(1).execute() {
24 Ok(pr) => println!("{}", pr),
25 Err(e) => eprintln!("✗ Error: {}", e),
26 }
27
28 Ok(())
29}
Trait Implementations§
Source§impl GhCommand for PrCreateCommand
impl GhCommand for PrCreateCommand
Auto Trait Implementations§
impl Freeze for PrCreateCommand
impl RefUnwindSafe for PrCreateCommand
impl Send for PrCreateCommand
impl Sync for PrCreateCommand
impl Unpin for PrCreateCommand
impl UnwindSafe for PrCreateCommand
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more