Skip to content

Commit 9074f73

Browse files
authored
Merge pull request #243 from Oxen-AI/feat/add-is-public-flag-to-cli
add is public flag to cli
2 parents 3a163d0 + 82c903b commit 9074f73

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

src/cli/src/cmd_setup.rs

+7
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,13 @@ pub fn create_remote() -> Command {
120120
.help("If present, it will create an empty remote that you need to push an initial commit to.")
121121
.action(clap::ArgAction::SetTrue),
122122
)
123+
.arg(
124+
Arg::new("is_public")
125+
.long("is_public")
126+
.short('p')
127+
.help("If present, it will create a public remote repository.")
128+
.action(clap::ArgAction::SetTrue),
129+
)
123130
}
124131

125132
pub fn remote() -> Command {

src/cli/src/dispatch.rs

+3
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,15 @@ pub async fn create_remote(
152152
name: impl AsRef<str>,
153153
host: impl AsRef<str>,
154154
empty: bool,
155+
is_public: bool,
155156
) -> Result<(), OxenError> {
156157
let namespace = namespace.as_ref();
157158
let name = name.as_ref();
158159
let host = host.as_ref();
159160
if empty {
160161
let mut repo_new = RepoNew::from_namespace_name(namespace, name);
161162
repo_new.host = Some(String::from(host));
163+
repo_new.is_public = Some(is_public);
162164
let remote_repo = api::remote::repositories::create_empty(repo_new).await?;
163165
println!(
164166
"🎉 Remote successfully created for '{}/{}' if this is a brand new repository:\n\n oxen clone {}\n\nTo push an existing repository to a new remote:\n\n oxen config --set-remote origin {}\n",
@@ -218,6 +220,7 @@ Happy Mooooooving of data 🐂
218220
}];
219221
let mut repo = RepoNew::from_files(namespace, name, files);
220222
repo.host = Some(String::from(host));
223+
repo.is_public = Some(is_public);
221224

222225
let remote_repo = api::remote::repositories::create(repo).await?;
223226
println!(

src/cli/src/parse_and_run.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,9 @@ pub async fn create_remote(sub_matches: &ArgMatches) {
117117
let namespace = parts[0];
118118
let name = parts[1];
119119
let empty = sub_matches.get_flag("empty");
120+
let is_public = sub_matches.get_flag("is_public");
120121

121-
match dispatch::create_remote(namespace, name, remote_host, empty).await {
122+
match dispatch::create_remote(namespace, name, remote_host, empty, is_public).await {
122123
Ok(_) => {}
123124
Err(err) => {
124125
eprintln!("{err}")

0 commit comments

Comments
 (0)