Skip to content
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

CLI: Make filename in verdi node repo cat optional for SinglefileData #5747

Merged

Conversation

sphuber
Copy link
Contributor

@sphuber sphuber commented Nov 3, 2022

Fixes #5746

The verdi node repo cat requires the relative path of the file that is to be displayed. For a SinglefileData, however, there only is a single path. The RELATIVE_PATH argument is now made optional if the node is a SinglefileData, otherwise it will raise like it always did.

…ata`

The `verdi node repo cat` requires the relative path of the file that is
to be displayed. For a `SinglefileData`, however, there only is a single
path. The `RELATIVE_PATH` argument is now made optional if the node is a
`SinglefileData`, otherwise it will raise like it always did.
@sphuber sphuber force-pushed the feature/5746/verdi-node-repo-cat-singlefile branch from c6200cf to d07cc81 Compare November 4, 2022 07:44
@sphuber sphuber modified the milestone: v2.1.0 Nov 4, 2022
Copy link
Member

@unkcpz unkcpz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Looks goo to me.

if not isinstance(node, SinglefileData):
raise click.BadArgumentUsage('Missing argument \'RELATIVE_PATH\'.')

relative_path = node.filename
Copy link
Member

@unkcpz unkcpz Nov 4, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remind me a bit what is the default filename if using the filelike for the SinglefileData?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is handled here

key = self.DEFAULT_FILENAME
so it is set to file.txt in that case.

@sphuber sphuber merged commit ef91d38 into aiidateam:main Nov 4, 2022
@sphuber sphuber deleted the feature/5746/verdi-node-repo-cat-singlefile branch November 4, 2022 08:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make verdi node repo cat determine the RELATIVE_PATH automatically for SinglefileData nodes
2 participants