Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
    Calvin Rose
    alias especially
    @bakpakin one nice thing
    you can do this
    (sh/alias ls (fn ls [&args] ...))
    at least pretty use you can
    sure :P if not, it is a bug
    oh darn, it is a bug. For now you need to do this -
    (put sh/*aliases* "ls" [(fn ...)] )
    I didn't intend that, but I just realized you can use it to write mini functions
    in your rc file
    like git-foobar ...
    or something
    maybe not git-foobar , but I perhaps can use it to automate some github stuff
    I suppose you could just write a file to disk lol, nvm :P
    user defined builtins can do more too
    Implemented the 'exec' builtin that bash has
    so you can go
    (sh/exec :2> '1)
    or (sh/exec ls )
    (sh/$ exec ...)
    technically you can exec in a pipeline, but it makes no sense
    The last two features for 0.1 I want, non linear pipelines, and spawning processes and getting access to the FD's
    they might be related or not, trying to think how they should work
    basically, how would you spawn netcat and connect it to a janet/sh repl
    without the -e command
    and also things like
    from bash you can do
    cat <(ls)
    But i think you can do
    cat < <(ls)
    which are slightly different
    though that is different again
    For a second I was imagining something like:
      :a ($ ls )
     :b ($ cat < :a)
    Probably too crazy.
    a simple way might just be
    (let [[a b] (pipes)]  ($ ls > [a] &) ($ cat < [b]))
    I am a fan of this simple way, even if it a bit manual, it seems easy to implement, and doesn't require much change at all.
    now we can redirect into core/file
    it's done
    Another fun idea
    expand core/file instances on the command line to /dev/fd/N
    (that is why I was thinking about multimethods)
    so users can define how their own types get expanded into command line arguments
    That would be a very nice feature
    yeah, not too sure what other uses there are
    but there must be some good ones