-
Notifications
You must be signed in to change notification settings - Fork 9
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
Added file subcommands #284
Conversation
28120de
to
df03861
Compare
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.
looks great
b2/_internal/console_tool.py
Outdated
{NAME} file info b2://yourBucket/file.txt | ||
{NAME} file url b2://yourBucket/file.txt | ||
{NAME} file cat b2://yourBucket/file.txt | ||
{NAME} file upload yourBucket localFile.txt file.txt | ||
{NAME} file download b2://yourBucket/file.txt localFile.txt | ||
{NAME} file copy-by-id sourceFileId yourBucket file.txt | ||
{NAME} file hide yourBucket file.txt | ||
{NAME} file update --legal-hold off b2://yourBucket/file.txt |
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.
the order seems pretty random
maybe just sort these lines?
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 tried to somewhat group them, first gets, then upload/download, then updates. Will sort
b2/_internal/console_tool.py
Outdated
# TODO we can't use 'copy-by-id', gets transformed to 'copy--by--id' | ||
COMMAND_NAME = 'CopyById' |
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.
can you fix these? Seems like simple change, for example:
diff --git a/b2/_internal/console_tool.py b/b2/_internal/console_tool.py
index ade898c..269ecf8 100644
--- a/b2/_internal/console_tool.py
+++ b/b2/_internal/console_tool.py
@@ -901,7 +901,9 @@ class Command(Described, metaclass=ABCMeta):
@classmethod
def name_and_alias(cls):
- name = mixed_case_to_hyphens(cls.COMMAND_NAME or cls.__name__)
+ name = cls.COMMAND_NAME or cls.__name__
+ if '-' not in name:
+ name = mixed_case_to_hyphens()
alias = None
if '-' in name:
alias = name.replace('-', '_')
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.
This is exactly what I was looking at.
There is another related issue, where both versions (with _
and with -
) are listed, I think we should not show the _
version:
b2 bucket [-h] {..., notification-rule,notification_rule}
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.
that should be fixable somewhere around
for choice in self._unique_choice_values(action): |
perhaps in _unique_choice_values itself
let me know if you want me to take care of it
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.
yes, I'll fix it, I just wasn't sure we want to
I've added a hackish workaround to hide the aliased subcommands Not sure if it's acceptable or not. I just realized that since we support a ton of versions, from 3.7 to 3.12, there is a probability that |
9e8a01a
to
d635f36
Compare
fdbcd5c
to
01505b6
Compare
8db2e43
to
98cece9
Compare
98cece9
to
e294c7a
Compare
Added
file
subcommands: