Open file from terminal

Similar to code example.txt or vim example.txt, repl example.txt (or whatever yalls choose to name this) should open example.txt in a CodeMirror editor.

hi @lawrencecchen Are you talking about terminal or shell because if you want to open an item in the terminal you can just use this code snippet below

open("file.txt", "w").write("Hello World")
read = open("file.txt").read()
print(read)

output would look like this

Hello World

or did you mean something else

2 Likes

What he wants is a command that you can type in the shell that opens a new tab in the Replit editor with the specified file.

So for example, repl open file.txt would open a new file tab so you can edit it.
Similar to how the code command opens VSCode with the specified file/folder.

2 Likes

@LuisAFK @lawrencecchen yeah lol that makes more sense

Can’t you just use read-write mode (instead of opening it twice), and please always close your files if you cannot using a with statement, unless you want corrupt files?

PS: I know this is not really related to the question it just bugs me

Edit: I just realized I am necro-posting, sorry, it was in recommended and I did not look at the date XD

1 Like

Do you want to open a file in the editor? If so, try replit-git-editor your.file.txt.

3 Likes