JohnSundell / JohnSundell/ShellOut

How to properly open a terminal editor?

Open
#77 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Swift
Stars
888
Forks
87
PR merge metrics
No merged PRs in 30d

Description

Hello 👋
Given this small piece of code:

```swift
import ArgumentParser
import ShellOut

@main
struct MyCliTool: ParsableCommand {

mutating func run() throws {

print("Hello, world!")
try shellOut(to: "nano /tmp/somefile.txt") // or (neo)vim
}

}
```

I would expect it to open up nano with the specified file. No such thing happens though:

![screenshot](https://github.com/JohnSundell/ShellOut/assets/143268175/1011a7d9-643e-45bc-a70f-8efa3006110d)

I experienced similar behaviour for other packages and for using `Process` directly.
I haven't used Swift beforehand and thought I could write my next small little CLI tool in it, this keeps me from doing so though.
Is there any way to properly start a terminal editor with ShellOut or should I search somewhere else?

Thank you :)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.