Hacker News new | past | comments | ask | show | jobs | submit login
FuncShell – A Haskell-based alternative to awk (github.com/iostreamer-x)
141 points by _iostreamer_ on May 1, 2017 | hide | past | favorite | 38 comments



Do any of you know how they got such a beautiful looking shell [0]? I'd love to know if there's a clean way to achieve such a nice result.

[0] https://github.com/iostreamer-X/FuncShell/raw/master/fsh.gif

EDIT

As an aside, FuncShell looks like a beautiful demonstration of how powerful Haskell can be. The source code is terse and clean.

The only oddity I noticed isthe rather large 68MB binary file committed into master in the repository [1]. Why do people do this? Especially on GitHub where there's support for cutting releases with a binary for each targeted platform...

[1] https://github.com/iostreamer-X/FuncShell/blob/master/fsh


If you're feeling adventurous you can also try Fish shell with it's collection of themes

https://github.com/oh-my-fish/oh-my-fish/blob/master/docs/Th...


>The only oddity I noticed isthe rather large 68MB binary file committed into master in the repository.

Thanks for bringing it to notice. I did this and later realized I can opt for the github release option[0]. I will fix this and the installation url asap.

[0] https://github.com/iostreamer-X/FuncShell/releases


Unfortunately, unless you rewrite history, it'll stay in there and bloat the download for anyone who wants to clone the repo.

I don't know if I want to recommend rewriting history or not. But for what it's worth, I'm currently on a cellular connection and couldn't download something this size if I wanted.


git clone --depth 1 if you don't need the history?


You probably want to compress it as well - that can easily reduce the file size by an order of magnitude.


That's a pretty standard zsh with oh-my-zsh prompt: https://github.com/robbyrussell/oh-my-zsh

Scroll down a bit and you'll see it.

Though I personally prefer zsh with prezto, because oh-my-zsh feels too bloated and heavy:

https://github.com/sorin-ionescu/prezto


Prezto is abandoned. If you absolutely need a framework go for Zim, although I like the simplicity of Zplug and adding plugins or themes as I need them.


The repo doesn't seem abondoned to me.


I stand corrected. Hadn't looked there in a while because the repo owner/maintainer had dropped off the grid for the better part of a year. Can't beat Zim it's speed though.. its even faster than Zplug despite Zim being a full framework and Zplug only a bare plugin manager.


Try zsh + oh-my-zsh https://github.com/robbyrussell/oh-my-zsh

I think the gif you linked is the vanilla oh-my-zsh theme.


It doesn't get much purer than pure - https://github.com/sindresorhus/pure


Also, the font is Adobe source code pro.


zsh + oh-my-zsh + agnoster zsh theme + powerline


Similar idea, but uses sqlite to make an awk like utility with sql syntax: https://github.com/dbohdan/sqawk


And just yesterday, people were asking [0] what Tcl is good for! This is a great example.

[0] https://news.ycombinator.com/item?id=14229266


There's also q, which I've happily used for all sorts of data munging tasks:

https://harelba.github.io/q/

One example from that page:

   ps -ef | q -H "SELECT UID,COUNT(*) cnt FROM - GROUP BY UID ORDER BY cnt DESC LIMIT 3"



Similar idea, but uses LUA as inline language: https://github.com/HeinrichHartmann/luawk

``` > printf abc | luawk -p '_:gsub("a","A")'

Abc ```


An awk with a luajit backend would be quite interesting.


Similar tools that use Python as the query language:

- The Pyed Piper: https://code.google.com/archive/p/pyp/

- Puffin: https://github.com/kespindler/puffin


Nice! How do I bring new function into scope though? This looks very similar to hawk, which has documentation on how to add your custom code [1].

Also, there are some nice CLI tools for JSON [2] or CSV [3] specific data.

  [1] https://github.com/gelisam/hawk
  [2] https://stedolan.github.io/jq/manual/
  [3] https://github.com/BurntSushi/xsv/blob/master/README.md


I think hawk should steal the idea of aliasing "|]" personally ;)


I always have mixed feelings on awk alternatives. I find awk to be one of the most underused tools in scripting. Awk has saved me numerous of times.

Now replacing latex with a modern syntax would be awesome!!!


I tried to explain to a historian with an open source textbook initiative the basics of latex. As soon as I opened the demo page that had looked nice enough, with him by my side, my heart sank. It's just so far away from being usable by non-technical users.

It's too bad, really.


A good theme and sharelatex.com can go a long way to get someone to use it. I usually only get Math Majors to invest in it.

I did almost all my Master Theology papers in it. Just difficult to use different languages. I usually have to use one or all of these Greek, Hebrew, Aramaic, Latin, Danish or German in my papers. Latex didn't make that easy. Actually nothing does.


I used sharelatex.

the notation full of \, {, }, etc. is just too confusing for people.


What isn't too confusing then? Markdown and HTML are just riffs, it's all based around the idea of opening/closing tokens and special tag names that do different things. I think if there is in fact a technical barrier, then it's the underlying fact that your representation of a document has a separation of content and design/layout. If people can't deal with that, then they can only use WYSIWYG (and not the hacks of rendering to the side while you still type in TeX), and there's no point in trying to update LaTeX's notation to fit people who never will get that underlying separation.


Markdown has fewer ways to inexplicably (from the point of view of a naive user) munge text.

If you type plain text, it mostly comes out as plain text.

I've paid John $4.50 for a sandwich.

Renders fine in Markdown. Renders like crap in LaTeX.


Markdown has its own magic incantations that can infuriate if you don't get them just right. GP is right: most people can't handle markup languages, period. Or, they can, but vastly prefer WYSIWYG text formatting.

For me, if I'm writing something for a web page, I use HTML in a decent editor (emacs). Markdown, reST, or anything else is not easier, just different.

If I need a really nice-looking document, I'll probably use LaTeX. But for a simple document or one that I'll work on with other people, I'll normally just use google docs.


34 renders fine in LaTeX, in Markdown when you then do 28 it's oh-no. (See this and many other HN comments.)


I like how you made this version use pipes instead of being a shell. Do you have any plans to create a new JS version of Awkward using pipes?


I understand that this caters to a very specific audience which knows haskell. Hence I plan to support JS as the inline language. I don't want to create a new JS version because I want to learn more of Haskell :p


In typical usage, do you need the type hints much? I saw ":: Float" in there for the df example, for instance.


Not really, in the example of df, I was filtering on the basis of size, which is not int usually but a decimal value, hence I had to provide the type hint.


I'm amazed by the powerline-command prompt. Shiny things seem to draw my attention a bit too much.


Haha, me too! I want to read an article on getting my zsh prompt to look like that.





Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: