Skip to content

How to properly open a terminal editor?#77

Description

@mj357

Hello 馃憢
Given this small piece of code:

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

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 :)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions