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

add pipe_once special command #193

Merged
merged 1 commit into from
Nov 23, 2024
Merged

add pipe_once special command #193

merged 1 commit into from
Nov 23, 2024

Conversation

danp
Copy link
Contributor

@danp danp commented Nov 14, 2024

Description

Updates #192

Adds \pipe_once / \| command for sending output to a program. Mostly copied from the same in mycli.

I also added a test for .once as part of getting started and changed it slightly to be structured more like mycli's version.

Checklist

  • I've added this contribution to the CHANGELOG.md file.

else:
with tempfile.NamedTemporaryFile(delete=False) as f:
litecli.packages.special.execute(None, "\\pipe_once tee " + f.name)
litecli.packages.special.write_pipe_once("hello world")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I changed this up from mycli, using tee to write the output to a file which can then be checked. But I did notice around here that mycli is using write_once in this test instead of write_pipe_once.

litecli.packages.special.write_pipe_once("hello world")
litecli.packages.special.unset_pipe_once_if_written()
else:
with tempfile.NamedTemporaryFile(delete=False) as f:
Copy link
Member

Choose a reason for hiding this comment

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

Curious why the delete=False here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Must have copied from above or elsewhere. But looks like if we know we aren't on windows we don't need this. Removed!

@amjith
Copy link
Member

amjith commented Nov 16, 2024

Apart from the one minor comment in the test, this looks good to me.

@amjith
Copy link
Member

amjith commented Nov 16, 2024

Thank you for taking the time to do this. I appreciate it very much. Thanks for pointing out the oversight in mycli test. I'll fix that as well. 😄

Mostly copied from mycli. Add tests for once as part of getting that
going.

Updates dbcli#192
@amjith amjith merged commit 233d84b into dbcli:main Nov 23, 2024
7 checks passed
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.

2 participants