Hello, I'm building an exercise framework on top of gitpod, So far I manage to create a beta version but I would be able to improve it better I you guys could incorporate the following to the Gitpod CLI:
$ gp close I'm already using gp open a lot, but I need to close the exercise filles when opening another exercise, otherwise the amount of files being edited grow to fast and becomes difficult to work with.$ gp user get the current github username$ gp file-opened get the current file where the cursor is focused.$ gp prompt <dom-selector> alert or prompt the user with a message pointing to a particular DOM element inside gitpod (or in the center of the screen).Here you can see the progress so far: https://gitpod.io/#https://github.com/4GeeksAcademy/html-exercises
Also, what would be the best way to check if gitpod is running on debug mode? I want to make sure students are using it during the exercises.
gitpod is running on debug mode
What do you mean by this?
$ gp prompt
alert or prompt the user with a message pointing to a particular DOM element inside gitpod (or in the center of the screen).
Could you elaborate a bit what this functionality is? Usually the GP cli is an interface to existsing functionality in gitpod from the command line. We don't have this functionality at the moment, do we?
gitpod is running on debug mode
What do you mean by this?
I want to be able to know if you are running your code using the play button on the debugger tool using a configuration pre-established on the launch.json file. Maybe there is no need for any extra development on your side and I can review certain env variables or ports opened.
$ gp prompt alert or prompt the user with a message pointing to a particular DOM element inside gitpod (or in the center of the screen).
Could you elaborate a bit what this functionality is? Usually the GP cli is an interface to existing functionality in Gitpod from the command line. We don't have this functionality at the moment, do we?
This is the least important of the features right now, the idea is to be able to show a help modal window with a message, similar to the one Gitpod shows at the beginning when it is your first time using it.
I want to do this because sometimes when the students run the exercises for the first time, they don't notice that the instructions are on the right side of the screen (preview). I want to open a modal in the center of the screen to make sure I have their attention.
@jankeromnes can I you guys do the $ gp close at least? That is the one that bothers students the most right now. We are starting to release/use the first 3 exercises:
HTML: https://github.com/4GeeksAcademy/html-exercises
CSS: https://github.com/4GeeksAcademy/css-exercises
React.js: https://github.com/4GeeksAcademy/react-exercises
Bootstrap: https://github.com/4GeeksAcademy/bootstrap-exercises
@alesanchezr I guess gp close file.txt would search for any open editors showing file.txt, and close them?
@32leaves How complicated would this be to implement? I took at look at the gp code, but didn't find an easy way to query Theia's currently open editors.
Maybe a flag on the $ gp open that closes any other open file? Or maby a "close all" command?
@jankeromnes is it possible to add a command to save the current opened file?
The problem is that when doing the exercises students for get to save before running the code, I would like to implement some king of "autosave" or saving the file before trying to test/run the code.
Do you have the code for the gitpod-cli open sourced? Maybe I can contribute to it under your lidership.
You can enable autosave in the preferences.
echo '{ "editor.autoSave": "on" }' > .theia/settings.json
Oh perfect.
Is .theia/settings.json now recognized per repository?
i'm still using /worspace/reponame/.vscode/settings.json and i hate it
you can use either .theia or .vscode. .theia has priority.
Ok so I have aded autosave to all exercises, I also added video introduction and tutorials for some of them but I'm still missing something, I beta-test the exercise engine with students every day and I think I need a way to open a modal, is there any way? Some if the exercises like the React.js ones are getting some traction, ~40 likes in github already!
I need the modal because its the only way to welcome the user and grab their attention, explain the basic steps to complete the exerises.
I believe fo such scenarios it would be better to go with a VS Code extension. There you can send messages: https://code.visualstudio.com/api/references/vscode-api#MessageOptions
I agree that gp close would be a very useful command to have, especially for automation purposes.
Also would be nice to have gp's source ^-^
I will see if I can implement some of these.
Also, @alesanchezr, to be clear for the gp prompt command you just want it to spawn a modal correct?
Yeah @JesterOrNot just to be able to grab the user attention and show an introductory message.
I think Gitpod already has a similar modal window when you open your first workspace for the first time ever, it shows you like the basics on how to use the Gitpod worspace.
Also, you said dom-selector how would that work? Would something like gp prompt <message_string> work where the modal would display the message_string?
The dom-selector you can forget, it's an overkill and I was able to replicate something like that inside the preview area.
The gp promt <message> works, but can it accept markdown or HTML? Because I wanted to show a message with some explanation not just like a js classic alert.
@alesanchezr did you try a vs code extension as I proposed in https://github.com/gitpod-io/gitpod/issues/800#issuecomment-588208964
Ideally, I don't want to bloat the gp command with stuff that is not used often and can be solved differently.
@svenefftinge I know, its just that most people doing our tutorials are first-time Gitpod users and they don't event know what an extension is, we mostly target junior devs learning code (for now) with little or no previous experience.
Eventually we will develop the extension when we start focusing in more experience users as well.
Most helpful comment
you can use either
.theiaor.vscode..theiahas priority.