question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

buttons executing custom commands or user menu like in mc

See original GitHub issue
  • Version (cloudcmd -v): v10.8.3
  • Node Version node -v: v8.15.0
  • OS (uname -a on Linux): Linux ulnoiotgw 4.14.79-v7+ #1159 SMP Sun Nov 4 17:50:20 GMT 2018 armv7l GNU/Linux
  • Browser name/version: all
  • Used Command Line Parameters: N/A
  • Changed Config: N/A

As most of my users completely fear the command line, I would like to be able to implement buttons (like for copy, mkdir, or console start) or a user menu (like happening on right click or like seen in midnight commander pressing F3) to execute some pre-defined commands in the respectively activated folder and showing their output while they are executing in the console.

How much effort would this be? Where would I have to start?

Usecase example

I have cloudcmd running on a headless raspberry pi that I control via the web using cloudcmd. I just made a copy of a template source folder and now want to use the initialize command to write this configuration to a microcontroller connected to the raspberry pi (or gateway computer). Now, I am starting the console per button press and type initialize and look at the output. It would be nicer if I had some kind of deploy button executing initialize in the right folder directly for me. If there were multiple commands possible (initialize, deploy, upgrade), maybe a pop-up menu would make sense.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:48 (24 by maintainers)

github_iconTop GitHub Comments

1reaction
ulnocommented, Feb 28, 2019

Positive Update: running on the raspberry pi in latest raspbian, I don’t have the problems (and terminal re-opening in new environment works, too -> which means I can move ahead, yeah, thanks so much).

So, why does it not work on my desktop?

As mentioned in thread beginning, cloudcmd pi-configuration is this:

* **Version** (`cloudcmd -v`): v10.8.3

now upgraded to v11.8.3 and patched as advised (cloned from current http://github.com/ulno/cloudcmd)

* **Node Version** `node -v`: v8.15.0

* **OS** (`uname -a` on Linux):  Linux ulnoiotgw 4.14.79-v7+ #1159 SMP Sun Nov 4 17:50:20 GMT 2018 armv7l GNU/Linux

* **Browser name/version**: all

My desktop:

  • same version of cloudcmd as on pi

  • Node Version node -v: v11.6.0 - that’s quite a difference

  • OS (uname -a on Linux): Linux ulno-t440p 4.19.16-1-MANJARO #1 SMP PREEMPT Fri Jan 18 17:03:05 UTC 2019 x86_64 GNU/Linux - the only thing which could have an impact here IMHO is the speed, my desktop is quite significantly faster than the pi (i7 4th gen quadcore with fast SSD), it also is not a Debian derivative, but an arch derivative (Manjaro)

Any idea, what could cause this and let me know if I can help to track this down - but apart from that, I am pretty happy at this point as it seems to work well on the pi and I might show off cloudcmd in my IoT framework on Wednesday with some simple user menus!

Update: issues with icons are gone in 11.8.5

1reaction
ulnocommented, Feb 1, 2019

client/modules/terminal.js passes env variables with currently selected path to executable command and it is updated.

This is incorrect. The variable is set only once (first start of terminal) and never updated. Worse, when the shell or command in terminal quits/ends the respawned process doesn’t have the environment variables anymore at all. You have to refresh the cloudcmd and terminal browser page to access the variable again.

Also, when the path in cloudcmd is changed after terminal was started, the variable doesn’t change in the started program (of course - a fork has a copy of the environment of the process it was started from).

If we can’t find a quick fix for this, this renders all my efforts useless - see below for some ideas.

terminal-kit should support mouse click as well. And resulting user menu can be bundle to Cloud Commander in case if it will be written in JavaScript. In the browser side it can be something similar to client/modules/terminal.js.

This works pretty well, I have spent a lot of time to convince terminal-kit to do something decent here and was kind of proud of my results (compare: https://github.com/ulno/ulnoiot/blob/master/bin/simple_shell.js, I wasted also a lot of time as I wanted to do it in python first, but python and ncurses is too slow for the raspberry pi, terminal-kit works good enough).

Unfortunately, this all falls apart as there is no way for me to get an updated path from cloudcmd.

Is there (1) a way to close the terminal window after an action is done (eventually adding a menu for different terminal sessions there - 1a) or (2) writing the paths always to a tmp-file or /var/run/cloudcmd that can be read before I execute something in the terminal, maybe the terminal should have an environment variable with an ID (2a) that refers to the temp file or a location in the tmp-file to allow multiple sessions?

I (and my students) would be very thankful if there would be a solution to this. I will start looking at cloudcmd code, if I can quickly hack solution 2 (2a can wait after my next class).

Read more comments on GitHub >

github_iconTop Results From Across the Web

CommandButtons ~ Execute Commands on Block Interaction
Customize messages and settings to your liking. Intuitive Editor GUI Edit all of your command buttons inside a user-friendly GUI menu.
Read more >
Creating Custom Commands with Multicraft - Knowledgebase
On the New Command page, fill out the textboxes and options based on your preference and how you want your custom command to...
Read more >
List of Custom Commands | Multi Commander
MC.Run, Run an external program ; MC.RunUserCmd, Run a User Defined Command ; MC.RunCmd, Run an Internal or User Defined Command ; MC.CmdLineSet,...
Read more >
Commanding in Windows apps - Microsoft Learn
Commands can be invoked directly through UI interactions like clicking a button or selecting an item from a context menu.
Read more >
Why is Button parameter "command" executed when declared?
It is called while the parameters for Button are being assigned: command=Hello(). If you want to pass the function (not it's returned value)...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found