Command line Editing in Console?

Working in the Roku console (“BrightScript Debugger>” prompt) is quite tedious if it has to be done for a long time. In particular i am missing the ability to recall previous commands and edit them. The only thing i know to work is Backspace (am i missing some other keys?).

Can we please have some better, basic editing of the command line? Pretty please (with Zucker on top). All i personally long for are:

  • Left/Right arrows to edit current line

  • Up/Down arrows to recall previous lines

  • … and that’s it!

Isn’t there some unix library for that already? I see the name “Readline” thrown around. If - as i suspect - the issue is that it is GPL-infected, well there are alternatives - for example this https://github.com/antirez/linenoise both has a permissive license and is 20x smaller.

PS. on a side note, last century called and they want their COMMAND.COM back: http://sdkdocs.roku.com/pages/diffpages … Id=3737101 - this side of the millennium, Windows shell is CMD.EXE. Apology for the nit-picking but as a recovering MCSE this rubs me the wrong way

If you’re already using Linux, you can use rlwrap to add readline features to your telnet client.

–Mark

“RokuMarkn” wrote:
If you’re already using Linux, you can use rlwrap to add readline features to your telnet client.
Nope, not using Linux. Using OSX and WIndows in turns. Sounds like a nice little utility for those that have it. For me though, to install on OSX i’ll have to re-visit Homebrew vs MacPorts vs Fink debates to figure to whose mercy should i surrender my Mac. And no clue what will it take on Windows.

I am however trying to use Roku and the pain is palpable. Can i entice you to disable “rlwrap” on your linux for couple of weeks?
And I bet that before that term is over, in an upcoming branch of the firmware the console line will miraculously grow editing features. :laughing:

That “minimal, zero-config, BSD licensed, readline replacement used in Redis, MongoDB, and Android [shells]” i ran into though?
One file, thousand (commented) lines, no pain.

I use Eclipse just for the console, which gives me those nice features, plus I can set it to save thousands of lines back, as much as I want.

Even with its shortcomings eclipse is the best. Can even open multiple telnets right next to the debug console for your scene graph threads. Would be nice to see a visual component plugin to design and generate scene graph components and XML. But that’s wishful thinking

Installing Roku Plugin’s version of Eclipse just for the console would be no better than running a Linux virtual machine for the “rlwrap” command alone. The roku-plugin seems more of a cruel practical joke (remember the Co’s April Fool’s jokes?), in stark contrast with Roku platform self-sufficiency (think Lotus) which i like.

Practically speaking though, it makes no sense fixing if i am the only crank unhappy with the lack of line editing in console.
Are there other developers that wish the ability was there - simple line editing while telnet-ed to 8085/8080 ? Raise your hand…

The subject ( your question) was about the console so the answers are related to the console. I don’t consider the plugin a practical joke. Eclipse is a fully integrated development environment when used with the plugin. This has met my needs as a 2D programmer with thousands of lines of code in dozens of projects all neatly organized and accessible in their various outliners and managers. The ability to use other plugins for XML, JSON, along with a language specific editor including help/suggestions add to its value. Then there is the packager, exporter , key generation etc. the ability to open multiple telnets to observe threads. The object outliner, the ability to associate files in the project with other software such as image editors, video editors etc… I have always used an IDE. Visual Studio being one of the first. Could not imagine how I would be able to organize let alone upload the infinite amount of times by switching back and forth between software just to perform a specific step in the development process which repeats hundreds of times during a normal work day, without using an IDE. make changes then select file-export and it is side loaded in a couple of seconds. Or the mistake is presented right there in front of you, click on it to be taken to the line in the file, fix it and your good to go.

Sure, I wish we had at least a history buffer in the console. The Eclipse plugin, if you can get it working, is a major improvement in many ways though:

Click on an error in the console and the source file/line will appear in the editor
Source directory file-contents search
Syntax Highlighting
one-click build-to-the-same device

  • Joel

I agree with EnTerr. I’ve tried installing Eclipse on 3 prior occasions and gave up on it for various reasons. Anything Java’y has always given me headaches. I’d rather use Notepad++ or Visual Studio or Atom or anything else, particularly since the features you need from an IDE for BrightScript development don’t exactly need to be “full-fledged”, at least for the stuff I work on.

It can’t be that hard to write a Windows console program that interfaces with the Roku Debugger, and provides better command-line handling than a Telnet client.

I have a few free days while I’m off work sick. I think I’ll get to work on it.

  • Command history
  • Line-based input instead of character-by-character input
  • Arrow keys: up, down, left, right
  • Maybe session logging and support for utf-8 output as well?

“RokuJoel” wrote:
… The Eclipse plugin, if you can get it working, is a major improvement in many ways though:

  • Click on an error in the console and the source file/line will appear in the editor

  • Source directory file-contents search

  • Syntax Highlighting

  • one-click build-to-the-same device
    Right, “if you can get it working” ;). Its dependence to particular version of Eclipse and general fragility have dissuaded me from touching it with a 10-foot pole. It’s a systemic problem - complex systems break in complex ways - and i don’t want to spend most of my time chasing peripheral problems (like crummy IDE module dependencies) from becoming central (breaking development).

The features you enumerated above are essential indeed! But i got them working already with a much simpler and more reliable setup. In OSX, it was some config tweaks to TextWrangler (a free programmer’s editor) and you got .BRS syntax highlighting, hot-key to package&deploy to device, naturally it has already the multi-file search, un/comment, text shift left/right, bracket-matching, support for JSON/XML/many more… and i think i got the jump-to-error-line too.

I was thinking of writing a “guide to lightweight Roku development” post after some fruitful PM exchange with squirreltown (what happened to that guy?) that made me realize not everybody feels comfortable keeping an open Terminal window. It actually made me improve my process by integrating the build script in the editor. (Anybody think they need specific instructions on how to do it? There is not much to it.) And that was umm… almost two years ago :shock:. Heck, i haven’t even written you (RokuJoel) yet a personal “thank you” note for your above-and-beyond assistance publishing a channel before the end of 2015!

“EnTerr” wrote:
[Its dependence to particular version of Eclipse
What dependence is that? I’ve run the Eclipse plugin in multiple versions of Eclipse from Juno to Mars. Personally, I find the Eclipse plugin works brilliantly for my needs, but I don’t use its packaging tools (I have my own makefiles for that).

I should also add my vote for native command history support in the debug console. I can use the Eclipse plugin’s command history for 8085, but that doesn’t help with the SceneGraph ports, which I’m having to interact with more and more as of late…

I’ve never particularly liked IDEs for one reason or another and I’ve never felt like one was necessary for Roku development (hence I’ve never even considered installing Eclipse). Although I have to admit some of NML’s comments make it sound intriguing, as soon as I see the word “Java”, count me out (is Eclipse Java-based?).

I’ve gotten by without a command history with copy and paste (what a pain), but it’s certainly the one item I’d like to see the console support. belltown, if you come up with a Windows console app with the features you propose, I think you’d be my hero. :grinning_face_with_smiling_eyes:

-JT

Hm, it’s hard to believe there isn’t already a Windows telnet client with command history. Have you checked putty or dtelnet or some of the other telnet programs?

–Mark

I use PuTTY and, unless I’m missing something, there’s no history. I’ve never searched for another, but it seems like a good idea.

-JT

On PuTTY, I can’t even get the left and right arrow keys to work. If you press the left-arrow key, for example, it echoes back: ^[[D.

On dtelnet, when you enter a command at the BrightScript prompt, e.g. “help”, it sends: “BrightScript Debugger> help” to the Roku.

I doubt there is a “Windows telnet client with command history”. I’ve looked and could not find one. puTTY is bee’s knees and if it does not have it, then nobody does. Another one plainly says ‘ConEmu is not a shell, so it does not provide “shell features” like tab-completion, command history and others.’

But neither do telnet clients for for OSX/*nix have a history support. I imagine that’s because most everywhere it’s done server-side already - e.g. i remember Cisco (and alike) CLI do.

You are lucky to have that rlwrap wrapper. Our of curiosity, doesn’t it cause issues with “hot keys” like ctrl-C and ctrl-S? Like having to hit Enter after ctrl-C to interrupt.

“EnTerr” wrote:

“RokuJoel” wrote:
… The Eclipse plugin, if you can get it working, is a major improvement in many ways though:
Right, “if you can get it working” ;). Its dependence to particular version of Eclipse and general fragility have dissuaded me from touching it with a 10-foot pole. It’s a systemic problem - complex systems break in complex ways - and i don’t want to spend most of my time chasing peripheral problems (like crummy IDE module dependencies) from becoming central (breaking development).

Sums up my experiences too.

Attempt #4, and I hadn’t even got to the part where you install the BrightScript plugin:

[upload|LV9Omb7t29JP1+q55YSnKg==]

For the Windows, non-Eclipse-using, Roku developers, I’ve put together a Windows Roku Debugger client that supports line-editing, command history, and Unicode debugger output. It’s a Python 3.5 program, roky.py.

You can get roky.py from https://github.com/belltown/roky There’s documentation at http://belltown-roku.appspot.com/Roky and on GitHub.

I’ve been using it with CMD.EXE, PowerShell, and MinGW without issues. It’s Windows-only unless someone wants to port it to a Mac.

Unfortunately, because of the way the Windows Console works, and the fact that Python’s readline implementation is blocking with no provisions for being interrupted, I had to use two independent console Windows, one for debugger commands, and one for debugger output, otherwise you wouldn’t be able to display debugger output until the user pressed the enter key. Still, the 2nd window is created automatically, and you can move and resize both windows to make it easier to enter debugger commands in the small window, and view the output in the large window.

Hopefully, some of you may find it useful. If anything, it gave me an excuse to start learning Python. I may look into developing a better GUI implementation later that can handle multiple tabs with a debug session in each tab.

“belltown” wrote:
For the Windows, non-Eclipse-using, Roku developers, I’ve put together a Windows Roku Debugger client that supports line-editing, command history, and Unicode debugger output. It’s a Python 3.5 program, roky.py.

You can get roky.py from https://github.com/belltown/roky There’s documentation at http://belltown-roku.appspot.com/roky.html and on GitHub.

Hopefully, some of you may find it useful. If anything, it gave me an excuse to start learning Python. I may look into developing a better GUI implementation later that can handle multiple tabs with a debug session in each tab.
Just started learning Python, you say? Wow.
I had a glance - great “penmanship”! Well documented. Just one note, you can get short names like so:

from ctypes.wintypes import BOOL, UINT, ULONG, WCHAR, HANDLE, SHORT, DWORD
from Win32 import GetFileType, GetStdHandle, WriteConsoleW, GetConsoleMode, GetCurrentConsoleFontEx, SetCurrentConsoleFontEx

Haven’t tried it, lazy to fire up windows machine. Should remember looking at this for example use of Win32.

GUI you say? If you are good at that, why don’t you go work for RokuCo and write them a proper IDE? They have been posting for years job listings for someone to write said IDE…