5 ms·
An idea that anyone is free to take: JSON-definable UI for command-line apps. Define checkboxes for flags, inputs for arguments, buttons for commands and file p
by flixic 5y ago
An idea that anyone is free to take: JSON-definable UI for command-line apps. Define checkboxes for flags, inputs for arguments, buttons for commands and file pickers / droppable wells for file input. Allow some customization of layout of these elements. Have in-app "store" to download these JSON definitions, maybe even suggest them based on `which` output. Electron app, obviously.
- colejohnson66 5y agoXML based UIs already exist with GtkBuilder and QtQuick(?). Although, your idea is more complex than that.
- jonny_eh 5y agoHTML is a pretty good XML-like UI builder.
- discordance 5y agoThat sounds like Gooey: https://github.com/chriskiehl/Gooey https://github.com/chriskiehl/Gooey, which creates GUIs for Python cli apps. Autogenerated based on the args, but configurable and the widgets and menus can be defined in JSON.
- flixic 5y agoGooey is a great northern star to follow, but this hypothetical app should work with any command-line app. Idea would be to define UI structure that outputs (and executes) essentially a string (command) to run.
- zorr 5y agoNot JSON, but related: Kaptain. https://github.com/mviereck/kaptain https://github.com/mviereck/kaptain
- flixic 5y agoThis is cool! Syntax might scare off many developers, I think one of the goals should be approachability, it should be super easy to transform your favorite command-line app into a GUI.
- ducktective 5y agoI've been asking HN for this some time ago: https://news.ycombinator.com/item?id=27820141 https://news.ycombinator.com/item?id=27820141 Also see: https://news.ycombinator.com/item?id=28461133 https://news.ycombinator.com/item?id=28461133
- flixic 5y agoIt seems to me that a lot of these projects aim to deliver really "good" apps: native UI, table output, etc… Results are great, but the UI building complexity also becomes quite high. I think that's the wrong goal. The goal should be really simple definitions and ok quality apps. Simple JSON (or XML, don't care). { control: checkbox, flag: c, label: "Compile" }
- deleted 5y ago[deleted]
- MR4D 5y agoSo like a modern day VB3 but built on Electron. Would be nice to have!
- notRobot 5y agopreferably not electron :)
- MR4D 5y agoI get the hate for Electron, but to me, despite the issues, it's not going away. I think a better approach is to figure out how to make Electron more performant in the various OSes. I haven't gotten into the internals of Electron, so I'm not the one to reflect on the approach, but seeing some of the improvements that MSFT made with Edge over Chrome in memory usage gives me hope that this is achievable, even if it doesn't happen immediately. Back in the 1990's we faced a similar thing, where web "apps" were ugly and slow, and not as powerful as the desktop apps that many corporations had developed in C++ or VB or Delphi. Today of course, the situation is much different, and we use web apps all the time. I really truly believe that Electron (or perhaps a successor - like how VS Code superseded Atom) will not go away, and in the future we will be much happier with it.
- HWR_14 5y ago> back in the 1990's we faced a similar thing, where web "apps" were ugly and slow And when's the last time you loaded an app with the Java VM on the desktop, unless it was Eclipse and you were about to use it to write more Java?
- slightwinder 5y agoWhy JSON? Just use a simplified subset of HTML and ignore styling+scripts for commandline. And for GUI/Web you can still offer the full HTML+CSS+Scripting-experience.
- flixic 5y agoCan be XML as well, but I think HTML is too complex. The goal, for me, is simplicity. <section name="Options"><checkbox flag="c" label="Compile" /></section> It shouldn't be a hassle at all to convert a man page to a UI that speeds up actions and avoids common errors. Anyway, this idea is free, so feel free to take it and do whatever, even full HTML (:
- slightwinder 5y agoI don't see how yet another ui-definition-format will help to make things simpler. And what UI does a manpage need? Manpages are documents, they have no real ui.
- jjnoakes 5y agoI think op meant covering a man page for a command into a gui for the command, not into a gui for the man page.
- jonny_eh 5y ago> HTML is too complex The suggestion was a simplified subset of HTML.
- jhgb 5y agoSounds a bit like Sciter, then.
- smashah 5y agoThis would require some sort of open-api type spec but for CLIs. I like this idea. Good luck to anyone taking it up.
- ape4 5y agoEverything doesn't have to be JSON ;)
- cabalamat 5y agoAgreed. The best format might be one specially defined for the job. I built a GUI-builder ages ago (in Python, compiling to Python which calls Tkinter to build the GUI). Here's a sample of what the UI-definition language looked like: https://github.com/cabalamat/parrot/blob/master/simple2.par https://github.com/cabalamat/parrot/blob/master/simple2.par
- bavell 5y agoLooks fine and dandy but could also be represented in JSON with not much effort and then you'd be using an interchange format understood by many tools instead of a bespoke language. I'm definitely biased being a web dev but JSON is just so widely used and supported... seems ideal for small bits of config like this.
- cabalamat 5y ago> Looks fine and dandy but could also be represented in JSON with not much effort Yes it could. But writing the UI descriptions would be harder in JSON than in my bespoke language. My goal in writing the tool was to maker UI descriptions as easy to write as possible. If I hadn't cared about that I wouldn't simply continued to hard-code them in Tkinter. > I'm definitely biased being a web dev but JSON is just so widely used and supported JSON didn't exist when I originally wrote this. If i was doing it today, it's entirely possible I would use JSON as a data interchange format.
- cabalamat 5y ago> But writing the UI descriptions would be harder in JSON than in my bespoke language. For example, this: menu "File" { menuItem @New "New" menuItem @Open "Open..." menuItem @Save "Save" menuItem @SaveAs "Save as..." menuItem @Exit "Exit" } Might become something like this: {'widget': 'menu', 'text': 'File', 'contents': [ {'widget': 'menuItem', 'id': 'New', 'text': 'New'}, {'widget': 'menuItem', 'id': 'Open', 'text': 'Open...'}, {'widget': 'menuItem', 'id': 'Save', 'text': 'Save'}, {'widget': 'menuItem', 'id': 'SaveAs', 'text': 'Save as...'}, {'widget': 'menuItem', 'id': 'Exit', 'text': 'Exit'} ] } Which would turn writing a UI from something that's a pleasure to something that's a chore. People who would deliberately write software that's a chore for others to use ought not IMO be writing software that will be used by other people.
- cabalamat 5y agoYou have to define the behavour of your UI elements as well as their placement, at which point you're writing a program. The best language to write a program in is a Turing-complete programming language specially designed for that task, not some cobbled together UI-definition language with ad hoc add-ons to processing.
- hungryforcodes 5y agoEveryone has different requirements. For many things, I'd take a quick JSON file configuration over having to write everything from scratch again and reinventing the wheel. Like it or not, the whole low code movement is about this.
- cabalamat 5y ago> I'd take a quick JSON file configuration Let's say your GUI has several input boxes. You want to validate those boxes. You need something Turing-complete to do this, because if it isn't Turing complete and the tool is used by lots of people, someone's GUI will require it. > the whole low code movement is about this That's OK provided you accept that it limits what can be done.
- _jal 5y agoThe best clothes are hand-tailored specifically to fit your body. And yet, most people wear mass-produced clothes.
- NegativeLatency 5y agoWell yes but to continue the metaphor almost nobody wears barrels
- HWR_14 5y agoMass produced clothes are significantly cheaper than barrels. Several orders of magnitude.
- platz 5y agoi was surprised how close this gets https://sanana.kiev.ua/index.php/yad https://sanana.kiev.ua/index.php/yad
- lbqjfw 5y agoFor native Mac apps, there is Platypus that does something similar: https://sveinbjorn.org/platypus https://sveinbjorn.org/platypus