Commit 150ee76
cli: add -e option to exec() code directly
The Python interpreter has "-c" which allows directly running code
provided as a command line argument. This is useful for quick tests,
without needing to write a script and execute it, and without needing to
run the interactive interpreter. It can also be used in scripts or
one-liners.
Unfortunately, "-c" is already used in the drgn CLI. However, this
functionality would be quite useful. Let's add it to the CLI using the
option "-e", which is short for "execute" or "exec", the underlying
Python function.
Signed-off-by: Stephen Brennan <[email protected]>1 parent 1b05b8c commit 150ee76
1 file changed
+13
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
491 | 491 | | |
492 | 492 | | |
493 | 493 | | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
494 | 500 | | |
495 | 501 | | |
496 | 502 | | |
| |||
502 | 508 | | |
503 | 509 | | |
504 | 510 | | |
505 | | - | |
| 511 | + | |
506 | 512 | | |
507 | 513 | | |
508 | 514 | | |
| |||
518 | 524 | | |
519 | 525 | | |
520 | 526 | | |
521 | | - | |
| 527 | + | |
522 | 528 | | |
523 | 529 | | |
524 | 530 | | |
| |||
564 | 570 | | |
565 | 571 | | |
566 | 572 | | |
567 | | - | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
568 | 578 | | |
569 | 579 | | |
570 | 580 | | |
| |||
0 commit comments