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 support for piping input to CodeEdit via CLI #34

Open
sermelipharo opened this issue Jan 3, 2025 · 0 comments
Open

Add support for piping input to CodeEdit via CLI #34

sermelipharo opened this issue Jan 3, 2025 · 0 comments

Comments

@sermelipharo
Copy link

The codeedit CLI currently does not support receiving input via pipe (|). Introducing this feature would allow developers to seamlessly use the codeedit CLI to interact with the CodeEdit app, enabling workflows similar to those supported by other editors, such as Sublime Text's subl CLI, which supports piping input directly into the editor.

Use Case

Developers often use CLI tools to process text and may want to quickly edit the output in CodeEdit. For example:

echo "Sample text" | codeedit  

With this feature, the codeedit CLI would behave similarly to subl from Sublime Text, opening a new tab or window in CodeEdit with the piped content for editing.

Benefits

  • Expands the utility of the codeedit CLI in developer workflows.
  • Positions CodeEdit as a competitive choice alongside editors like Sublime Text.
  • Enables seamless integration with terminal-based pipelines.

Suggested Implementation

  1. Input Detection:
    The codeedit CLI should recognize when input is piped into it.

  2. Temporary File Handling:
    Create a temporary file containing the piped input and open it in CodeEdit.

  3. Optional Flag:
    Provide a --pipe flag to explicitly handle piped input, similar to how subl operates.

Example

# Open piped text in CodeEdit  
echo "Edit this text" | codeedit  

# Example from Sublime Text for comparison  
echo "Edit this text" | subl  

Additional Considerations

  • Temporary File Management: Ensure that temporary files are removed after the editing session ends.
  • Efficient Input Handling: Handle large piped inputs efficiently to avoid performance bottlenecks.
  • Custom Options: Allow configuring how piped input is managed (e.g., open in a new tab, new window, or append to an existing file).

By adopting a similar approach as subl, CodeEdit could provide a familiar and powerful experience for developers, while leveraging CodeEdit's unique features and interface.

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

No branches or pull requests

1 participant