-
Notifications
You must be signed in to change notification settings - Fork 8
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
Implement b2 file unhide
command
#297
Implement b2 file unhide
command
#297
Conversation
b2/_internal/console_tool.py
Outdated
@classmethod | ||
def _setup_parser(cls, parser): | ||
add_bucket_name_argument(parser) | ||
parser.add_argument('fileName').completer = file_name_completer |
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.
seems like there was oversight on our part an we did not update b2 file hide
to use B2URI when doing b2v4
Please correct our mistake, i.e.:
- in this command only support b2uri argument
- in
b2 file hide
support both new and old syntax, but the--help
should be only speaking of new syntax - the
b2v3 hide-file
should remain unchanged
b2/_internal/console_tool.py
Outdated
@@ -712,6 +713,20 @@ def get_b2_uri_from_arg(self, args: argparse.Namespace) -> B2URIBase: | |||
return args.B2_URI | |||
|
|||
|
|||
class B2URIFileOrBucketNameArgMixin: |
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.
class B2URIFileOrBucketNameArgMixin: | |
class B2URIFileOrBucketNameFileNameArgMixin: |
and move
def _setup_parser(cls, parser):
parser.add_argument(
'fileName', nargs='?', help=argparse.SUPPRESS
)
in here as well
and drop completer - it will simply not work properly since the first argument will be completed using B2 URI completer
and I guess we have no need for add_b2id_or_file_like_b2_uri_or_bucket_name_argument
I don't know any command that takes either B2URI or plain bucketName, in general we are pushing towards using B2 URI always.
console_tool.run_command(['b2', 'file', 'hide', 'b2://my-bucket/1/hidden1']) | ||
console_tool.run_command(['b2', 'file', 'hide', 'my-bucket', '1/hidden1']) | ||
console_tool.run_command(['b2', 'file', 'hide', 'my-bucket', '1/hidden1']) | ||
console_tool.run_command(['b2', 'file', 'hide', 'my-bucket', '1/hidden2']) | ||
console_tool.run_command(['b2', 'file', 'hide', 'b2://my-bucket/1/hidden2']) |
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.
please create a new unit test that check just legacy syntax since it is rather complex right now to determine whenever the "fileCount": 28,
is correct or not and mixing more cases in single tests makes it even more complex
That test can simply create a file, execute legacy hide command and check if the is indeed hidden
Co-authored-by: Maciej Urbański <[email protected]>
Co-authored-by: Maciej Urbański <[email protected]>
Co-authored-by: Maciej Urbański <[email protected]>
Implement
b2 file unhide
command