question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Documenting what syntax works and what doesn't

See original GitHub issue

In 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:closed
  • Created 2 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
manfredlotzcommented, Aug 3, 2021

~f'{cmd:raw}' works fine. Looks like a good solution. Thanks a lot, @tusharsadhwani

1reaction
Jackenmencommented, Aug 3, 2021

Assuming 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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found