News for hackers. Stuff that matters.
Re:CLI: Improved by adwhit on Thursday August 30, 2018 @06:08PM (#17881246)
A more generous interpretation might be that Rust has sparked a CLI renaissance, since it lets developers write CLIs that have that satisfying zip that previously was only possible in C. None of PHP, Ruby or Java is responsive enough for a good CLI tool (also, static compilation is a must for wide deployment).
Re:CLI: Improved by vram22 on Thursday August 30, 2018 @07:58PM (#17881867)
FreePascal has been around for a long time and supports CLI programming. Maybe not very much support in the basic language and stdlib, but the essentials are there (CLI arg handling and file I/O). Third-party libraries may have more and you can always write your own. Both speed and size of binaries are good. I had compiled some simple CLI programs and they were under 100K, maybe under 50K. It's also supposed to be quite cross-platform, though I have not checked that out.

Also, I don't know Rust (but have read that it is somewhat difficult to learn); for the basics, FreePascal (FP) may be easier than Rust to learn and start using, because although it (FP) has advanced language features, for many basic CLI programs, the simpler procedural features should be enough.

https://freepascal.org/

Re:CLI: Improved by jaco8 on Thursday August 30, 2018 @09:36PM (#17882279)
You would be very, very pleased with Nim.

https://nim-lang.org/

Re:CLI: Improved by vram22 on Friday August 31, 2018 @08:44AM (#17885053)
Thanks. I had seen some HN threads on it, but had not really checked it out. Will do so.
Re:CLI: Improved by jetti on Thursday August 30, 2018 @07:09PM (#17881625)
Not to mention you get a language that is enjoyable but also compiles to native code. My first Rust project was a Haml parser and I created a CLI for it too that is similar to the Ruby version. It is nice being able to ship the 8Mb executable and not have to worry about users having the right runtime.
Re:CLI: Improved by carlmr on Friday August 31, 2018 @02:39AM (#17883422)
Also don't forget Cargo. It makes it so much easier to work with than installing C/C++ dependencies.
Re:CLI: Improved by jetti on Friday August 31, 2018 @09:52AM (#17885558)
Cargo is awesome too. Cargo reminds me of Mix (from the Elixir ecosystem). The one thing that Mix has on Cargo is that it is super simple and straight forward to extend Mix. Cargo may be the same way but from what I've seen it seems more complicated.
Re:CLI: Improved by steveklabnik on Friday August 31, 2018 @10:01AM (#17885629)
That’d make sense given the common ancestry in Bundler :)

Do you have any docs on what you mean by extensibility here? I’m curious!

Re:CLI: Improved by jetti on Friday August 31, 2018 @10:17AM (#17885750)
Sure! Take a look at Mix.Task [0]. You basically name your module Mix.Tasks.X where X is whatever you want the command to be and then include "use Mix.Task" and implement the run function and you have now extended Mix. You call the task my running "mix X" and it will run the code in the run function. I created a small task that generates ORM models for Ecto (Elixir's de facto ORM library) using Mix tasks [1]. So the user types mix plsm and they can generate the code.

[0] https://hexdocs.pm/mix/Mix.Task.html [1] https://github.com/jhartwell/Plsm

Re:CLI: Improved by steveklabnik on Friday August 31, 2018 @01:50PM (#17887535)
Ah ha! Thanks. So yeah, if you have an executable in your PATH named cargo-foo, then “cargo foo” will execute it. But we’re planning on having that style of functionality in the future as well, the cod name is “tasks”, but it still doesn’t have an RFC.
Re:CLI: Improved by jetti on Friday August 31, 2018 @01:54PM (#17887564)
I'll definitely want to check out that RFC when/if it opens up. I didn't realize that cargo did that with the executables, that's good to know. Thanks!
Re:CLI: Improved by pjmlp on Friday August 31, 2018 @02:17AM (#17883333)
Just like any other compiled language.

GCC's static linking issues with glibc don't apply to other compilers.

Re:CLI: Improved by jetti on Friday August 31, 2018 @09:50AM (#17885542)
No, not like any other compiled language. Just like any other native compiled language, maybe, but Java and C# are also compiled yet require a large runtime in order to run any application. An 8Mb executable written in Rust is going to be 8Mb total. An 8Mb executable written in C# or Java is going to weigh much more than that when you take into account the framework. Now, one could argue that it is almost a given for the JVM to be installed on a given computer but you can't say the same for .NET when doing cross-platform development.
Re:CLI: Improved by pjmlp on Friday August 31, 2018 @10:34AM (#17885896)
Java and C# are also native compiled languages, with linker support.

You just have to look properly for those options.

The only thing is that not all of them are free beer.