-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Branches: REPL backslash commands for branches (#1284)
- Loading branch information
Showing
15 changed files
with
150 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
mod context; | ||
pub mod context; | ||
mod create; | ||
mod drop; | ||
mod list; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
use crate::branch; | ||
use crate::commands::parser::BranchingCmd; | ||
use crate::connect::Connection; | ||
use crate::commands::Options; | ||
|
||
pub async fn main(connection: &mut Connection, cmd: &BranchingCmd, options: &Options) -> anyhow::Result<()> { | ||
let context = branch::main::create_context().await?; | ||
|
||
branch::main::run_branch_command(&cmd.into(), options, &context, Some(connection)).await | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
use crate::commands::list_databases::get_databases; | ||
use crate::commands::{list, list_databases, Options}; | ||
use crate::connect::Connection; | ||
use crate::print; | ||
|
||
pub async fn get_branches(cli: &mut Connection) -> anyhow::Result<Vec<String>> { | ||
get_databases(cli).await | ||
} | ||
|
||
pub async fn list_branches(cli: &mut Connection, options: &Options) | ||
-> Result<(), anyhow::Error> | ||
{ | ||
let version = cli.get_version().await?; | ||
|
||
if version.specific().major <= 4 { | ||
print::warn(format!("Branches are not supported in EdgeDB {}, printing list of databases instead", version)); | ||
return list_databases(cli, options).await; | ||
} | ||
|
||
list_branches0(cli, options).await | ||
} | ||
|
||
pub async fn list_branches0(cli: &mut Connection, options: &Options) -> Result<(), anyhow::Error> { | ||
let databases = get_branches(cli).await?; | ||
list::print(databases, "List of branches", options).await?; | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.