Documenting what syntax works and what doesn't
See original GitHub issueIn the zxpy
repl I tried various ways of issuing a cmd and some did not work.
zxpy shell
Python 3.8.10 (default, Jun 2 2021, 10:49:15)
[GCC 9.4.0]
>>> ~'uname'
Linux
>>> cmd = 'uname'
>>> ~f'{cmd}'
Linux
>>> ~cmd
Traceback (most recent call last):
File "/home/manfred/.local/lib/python3.8/site-packages/zx.py", line 295, in install
exec(code_obj)
File "<input>", line 1, in <module>
TypeError: bad operand type for unary ~: 'str'
>>> cmd = 'uname -a'
>>> ~f'{cmd}'
/bin/sh: 1: uname -a: not found
>>> ~cmd
Traceback (most recent call last):
File "/home/manfred/.local/lib/python3.8/site-packages/zx.py", line 295, in install
exec(code_obj)
File "<input>", line 1, in <module>
TypeError: bad operand type for unary ~: 'str'
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (6 by maintainers)
Top Results From Across the Web
Document command-line syntax - Google Developers
Key Point: Recommendations for documenting command-line tools. This page shows how to document command-line commands and their arguments.
Read more >Documenting Python Code: A Complete Guide
Documenting Your Python Code Base Using Docstrings: A deep dive into docstrings for classes, class methods, functions, modules, packages, and scripts, as well ......
Read more >Documentation Style Guide - GitLab Docs
Documentation Style Guide. This document defines the standards for GitLab documentation, including grammar, formatting, word use, and more.
Read more >Effective Dart: Documentation - Dart programming language
The backtick syntax avoids those indentation woes, lets you indicate the code's language, and is consistent with using backticks for inline code. ///...
Read more >JSDoc Reference - TypeScript: Documentation
You can use most JSDoc type syntax and any TypeScript syntax, from the most basic like string to the most advanced, like conditional...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
~f'{cmd:raw}'
works fine. Looks like a good solution. Thanks a lot, @tusharsadhwaniAssuming it works (can’t really check right now), I think it’s awesome you managed to support both ways with an easy syntax like this 😃 I also like that the default remained the same as it should help people avoid introducing shell injection by accident.