back

by jeffreyrogers·12y ago·view on hn ↗
This is an interesting idea, but I'm not sure it has much use outside of proof of concept. Most people don't need to use the command line, and those who do don't find it that difficult.

In fact, for the most part the command line is very usable once you've learned the philosophy behind it. I remember reading something about the BSD flavors of UNIX along the lines of "BSD is very user friendly, just not for inexperienced users". I see the command line as being similar. It's very powerful when you understand it, but a bit opaque when you're learning it. Fortunately, you can learn the basics in an afternoon.

Now one useful aspect of this is that it makes commands that would require a long command line much simpler than they would otherwise be. However, I find that whenever I have a long command line that I use repeatedly I just write an alias for it and add it to my .zsh-aliases file. I like this solution better because it is more customizable for my workflow.

2 comments
Well, an argument could be made for having the alias-file be something like:

    alias ll="ls -l"
      doc = """List files -- long list format"""
      natural_match = "list all files long size date owner group"
And have:

    "list all files by size"
match this (as betty does now: running ll "docstring". Then, when you realize that "list all files by size", really is "ls --sort=size", possibly with "-l", you could just add another definition:

    alias lss="ls -l --sort=size"
      doc = """List files -- sorted by size, long list format"""
      natural_match = "list all files sort by size long format"
      natural_exact_match "list all files by size"
And now have:

    "list all files by size"
Score higher for lss than for ll (the scoring function is assumed to be some combination of tag count, proximit match, substring match etc, a so-called hard problem, but only needs to match over defined aliases -- and trying hard to first match the "exact_match" part...).

Of course, it should all be paired by a define-command or something that autmatically saves these monstrosties to a file or other db. So that you could do:

     # Lots of head scratching and experimentation, until:
     nmcli dev wifi list |sort -k8 -n # list wifi access points by
                                      # signal strength

     # define prev as "list wifi access points by signal strength"
     > displays commmand and prompt for tags etc, then on "y" at y/n
       prompt saves definition to "alias" file.

Come to think of it, it's a little like mandating/recommending users to document their aliases, and to have the shell automatically suggest from the docstrings. I guess zsh actually does a bit of this already (I'm still sticking with bash, it's gotten good enough for me over the years, and I'm always terrified by something, that if it isn't posix/ksh also isn't bash -- as that just makes scripts brittle...).
exactly .

Also this is not the best example to start with imo,

  betty whats my username
  Betty: Running whoami
  jrp
may be should put better example in the beginning