xonsh / peg-parser

xonsh-parser
MIT License
2 stars 1 forks source link

Add `@` as alternative to `__xonsh__` #2

Open anki-code opened 4 months ago

anki-code commented 4 months ago

It will be cool to have this:

@
# <xonsh.built_ins.XonshSession at 0x1064fd9a0>

@?
# XonshSession doc string with description @.env, @.imp, @.last, @.history, etc.

@.env                                    # instead of `__xonsh__.env` and forget about `${...}`
@.history                                # instead of `__xonsh__.history`
@.imp.json.loads('{}')                   # https://github.com/xonsh/xonsh/pull/5595

with @.env.swap(SOMEVAR='foo'):
     echo $SOMEVAR
anki-code commented 4 months ago

@jnoortheen is it possible to implement this in the current version of parser as well with minimal changes? It will be super awesome and support https://github.com/xonsh/xonsh/pull/5595

anki-code commented 4 months ago

@jnoortheen here is the motivation - https://github.com/xonsh/xonsh/issues/5411#issuecomment-2223362149