Skip to content

Releases: tusharsadhwani/zxpy

Add support for raw shell-strings

03 Aug 14:21
Compare
Choose a tag to compare

Now you can pass whole commands as variables inside f-strings, without quoting.

Take this piece of code:

>>> cmd = 'uname -a'
>>> ~f'{cmd}'
/bin/sh: 1: uname -a: not found 

This is because uname -a was quoted into 'uname -a' to avoid shell injection.

To avoid this, support for :raw format_spec as added:

>>> cmd = 'uname -a'
>>> ~f'{cmd:raw}'
Linux pop-os 5.11.0 [...] x86_64 GNU/Linux

Note that this shouldn't be used with external data, or this will expose you to shell injection.

Fix printing logic

29 Jul 19:30
Compare
Choose a tag to compare

Previously, only a few select ~'...' statements were being printed out, rather than any bash-string without any assignments to its left. This patch version fixes printing logic.

Fix bug with global scope

17 Jul 07:15
Compare
Choose a tag to compare

Fixes the previous broken build, refer #19

Fix __name__ global definition

16 Jul 13:50
Compare
Choose a tag to compare

Fix __name__ and argument parsing

10 Jul 14:17
Compare
Choose a tag to compare
  • __name__ will now be '__main__', just like how it is when running any other file directly
  • Passing additional arguments to zxpy command is now supported

Add argument quoting inside bash fstrings

02 Jul 18:39
Compare
Choose a tag to compare

Anything passed as an f-string into a bash string will be automatically quoted with shlex.quote.

i.e., ~f'{xyz}' is the same as ~f'{shlex.quote(xyz)}

Add stderr and return code support

23 Jun 12:55
Compare
Choose a tag to compare
  • Alternate method of invoking shell commands: stdout, stderr, return_code = ~'...'. Fixes #6
  • Add a few tests.

Fix `sys.argv`

09 Jun 09:14
Compare
Choose a tag to compare
  • Removes zxpy executable from sys.argv, to mimic default python behaviour (#10)

Bugfixes

21 May 17:12
Compare
Choose a tag to compare
  • Finally figured out the correct way to handle expr transformations. Cleaned up a bunch of AST code.
  • Shell strings and shell f-strings should be usable inside call statements now, eg. print(~'echo test')

Housekeeping

21 May 07:21
Compare
Choose a tag to compare
  • Renamed zx.start() to zx.install() for clarity