-
Notifications
You must be signed in to change notification settings - Fork 177
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
spacetime publish
: Add confirmation for -c
#1038
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not try to preserve the API here, just break it and we'll merge this as part of 0.9 next week.
.requires("name_or_address") | ||
.conflicts_with("destroy_previous") | ||
.action(SetTrue) | ||
.help("DEPRECATED - Use --destroy-previous"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did we add this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see this is a backwards compatible thing - let's just mark this as an API break and merge it for 0.9.
@@ -110,7 +125,8 @@ pub async fn exec(mut config: Config, args: &ArgMatches) -> Result<(), anyhow::E | |||
let name_or_address = args.get_one::<String>("name|address"); | |||
let path_to_project = args.get_one::<PathBuf>("project_path").unwrap(); | |||
let host_type = args.get_one::<String>("host_type").unwrap(); | |||
let clear_database = args.get_flag("clear_database"); | |||
let clear_database = args.get_flag("destroy_previous") || args.get_flag("deprecated_clear_database"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's just break the API here and not change this
@@ -163,6 +175,31 @@ pub async fn exec(mut config: Config, args: &ArgMatches) -> Result<(), anyhow::E | |||
database_host | |||
); | |||
|
|||
if clear_database { | |||
// This is to preserve backwards-compatibility with the old --clear-database. | |||
if force || args.get_flag("deprecated_clear_database") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove || args.get_flag("deprecated_clear_database")
// TODO(jdetter): Rename this to --delete-tables (clear doesn't really implies the tables are being dropped) | ||
Arg::new("clear_database") | ||
.long("clear-database") | ||
Arg::new("destroy_previous") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's keep this as clear-database
- I realized that this was us trying to not break backwards compatibility but let's just break the API in this case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually renamed this because of the TODO
above - I'm fine to revert, but I do agree with it in principle!
Is there a reason we're renaming the long version, and not the short version? I don't think the inconsistency is worth it. What is wrong with |
The feedback that you gave at the time was that |
Arg::new("clear_database") | ||
.long("clear-database") | ||
Arg::new("delete_tables") | ||
.long("delete-tables") | ||
.short('c') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
keeping the -c
flag here kinda seems like its legacy. I believe we can't use -d
because we're using that for the debug flag. Maybe we just keep --clear-database
and drop the TODO, what do you think @bfops @cloutiertyler ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tyler already responded on this PR - let's just change this back to --clear-database
and this is good to merge, thanks Zeke 👍
@@ -163,6 +167,30 @@ pub async fn exec(mut config: Config, args: &ArgMatches) -> Result<(), anyhow::E | |||
database_host | |||
); | |||
|
|||
if delete_tables { | |||
if force { | |||
eprintln!("Skipping confirmation due to --force."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would recommend just using println
here instead of eprintln
} | ||
query_params.push(("clear", "true")); | ||
} | ||
|
||
eprintln!("Publishing module..."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even though its not part of this PR I would recommend changing this to println
as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small request and then good to merge, thanks Zeke 👍
Arg::new("clear_database") | ||
.long("clear-database") | ||
Arg::new("delete_tables") | ||
.long("delete-tables") | ||
.short('c') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tyler already responded on this PR - let's just change this back to --clear-database
and this is good to merge, thanks Zeke 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks Zeke 👍
"--project-path", self.project_path, | ||
*(["-c"] if clear else []), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- specifying
-c
without adomain
is now a CLI error - added
--force
to avoid confirmation
Description of Changes
Making this change in response to a request from the BitCraft team.
spacetime publish -c
now asks for confirmation, unless a new--force
is passed as well.API and ABI breaking changes
This will break any automation using
spacetime publish -c
.I think that's an acceptable level of break? @jdetter ?
Expected complexity level and risk
How complicated do you think these changes are? Grade on a scale from 1 to 5,
where 1 is a trivial change, and 5 is a deep-reaching and complex change.
2
This complexity rating applies not only to the complexity apparent in the diff,
but also to its interactions with existing and future code.
If you answered more than a 2, explain what is complex about the PR,
and what other components it interacts with in potentially concerning ways.
Testing