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

Support piping text into the editor from the command line #15071

Closed
natesilva opened this issue Nov 6, 2016 · 2 comments
Closed

Support piping text into the editor from the command line #15071

natesilva opened this issue Nov 6, 2016 · 2 comments
Labels
feature-request Request for new features or functionality install-update VS Code installation and upgrade system issues
Milestone

Comments

@natesilva
Copy link

  • VSCode Version: 1.7.1
  • OS Version: macOS 10.12.1

With the code command installed in your PATH it should be possible to pipe text into the editor from the command line:

$ curl -L bing.com | code

In this example, I’d expect Code to open and show me the output of the curl command (which would be the HTML of the Bing home page).

This works with Sublime Text (subl command) and TextMate (mate command). It would be great if code did this too.

@joaomoreno joaomoreno added this to the Backlog milestone Nov 7, 2016
@joaomoreno joaomoreno added the feature-request Request for new features or functionality label Nov 7, 2016
@joaomoreno joaomoreno added the install-update VS Code installation and upgrade system issues label Apr 26, 2017
@joaomoreno joaomoreno removed their assignment Jun 19, 2017
@melMass
Copy link

melMass commented Nov 18, 2017

For now I use the following:

codepipe (file needs to be chmod +x and in your $PATH)

#!/bin/sh

if [ ! -t 0 ]; then
    	#set -- "${@}" $(cat)
		out=$(cat)

else
	echo "no pipe detected"
	exit 0

fi
if [ -z "${1}" ]; then
	echo "no filename provided"
	exit 0
fi
if [ -f "${1}" ]; then
	echo "file exists."
	exit 0

fi

echo ${out} > "${1}"
code "${1}"

usage:

curl -L bing.com | codepipe bing.html

@natesilva
Copy link
Author

Dupe of #6161 which was closed today. 🎉

@vscodebot vscodebot bot locked and limited conversation to collaborators Jan 11, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality install-update VS Code installation and upgrade system issues
Projects
None yet
Development

No branches or pull requests

3 participants