Show aliases in command help and docs (#2960)

* print aliases with command help

* show alias in docs; singular if there is only one alias

* autogen docs

* remove dot from alias line

* autogen docs
pull/2967/head
k4lizen 7 months ago committed by GitHub
parent 05bd01a140
commit d2ac1430b8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -12,6 +12,8 @@ usage: breakrva [-h] [offset] [module]
```
Break at RVA from PIE base.
**Alias:** brva
### Positional arguments
|Positional Argument|Help|

@ -12,6 +12,8 @@ usage: context [-h] [--on] [--off] [subcontext ...]
```
Print out the current register, instruction, and stack context.
**Alias:** ctx
### Positional arguments
|Positional Argument|Help|

@ -12,6 +12,8 @@ usage: contextnext [-h] [count]
```
Select next entry in context history.
**Alias:** ctxn
### Positional arguments
|Positional Argument|Help|

@ -12,6 +12,8 @@ usage: contextoutput [-h] section path clearing [banner] [width]
```
Sets the output of a context section.
**Alias:** ctx-out
### Positional arguments
|Positional Argument|Help|

@ -12,6 +12,8 @@ usage: contextprev [-h] [count]
```
Select previous entry in context history.
**Alias:** ctxp
### Positional arguments
|Positional Argument|Help|

@ -12,6 +12,8 @@ usage: contextsearch [-h] needle [section]
```
Search for a string in the context history and select that entry.
**Alias:** ctxsearch
### Positional arguments
|Positional Argument|Help|

@ -12,6 +12,8 @@ usage: contextunwatch [-h] num
```
Removes an expression previously added to be watched.
**Aliases:** ctx-unwatch, cunwatch
### Positional arguments
|Positional Argument|Help|

@ -14,6 +14,8 @@ usage: contextwatch [-h] [{eval,execute}] expression
Adds an expression to be shown on context.
To remove an expression, see `cunwatch`.
**Aliases:** ctx-watch, cwatch
### Positional arguments
|Positional Argument|Help|

@ -12,6 +12,8 @@ usage: nearpc [-h] [-e] [pc] [lines]
```
Disassemble near a specified address.
**Aliases:** pdisass, u
### Positional arguments
|Positional Argument|Help|

@ -15,6 +15,8 @@ usage: vis-heap-chunks [-h] [--beyond_top] [--no_truncate] [--all_chunks]
Visualize chunks on a heap.
Default to the current arena's active heap.
**Alias:** vis
### Positional arguments
|Positional Argument|Help|

@ -12,6 +12,8 @@ usage: bn-sync [-h]
```
Synchronize Binary Ninja's cursor with GDB.
**Alias:** bns
### Optional arguments
|Short|Long|Help|

@ -12,6 +12,8 @@ usage: r2 [-h] [--no-seek] [--no-rebase] [arguments ...]
```
Launches radare2.
**Alias:** radare2
### Positional arguments
|Positional Argument|Help|

@ -12,6 +12,8 @@ usage: rop [-h] [--grep GREP] [--memlimit MEMLIMIT] [argument ...]
```
Dump ROP gadgets with Jon Salwan's ROPgadget tool.
**Alias:** ropgadget
### Positional arguments
|Positional Argument|Help|

@ -12,6 +12,8 @@ usage: rz [-h] [--no-seek] [--no-rebase] [arguments ...]
```
Launches rizin.
**Alias:** rizin
### Positional arguments
|Positional Argument|Help|

@ -12,6 +12,8 @@ usage: envp [-h] [name]
```
Prints out the contents of the environment.
**Aliases:** env, environ
### Positional arguments
|Positional Argument|Help|

@ -12,6 +12,8 @@ usage: go-dump [-h] [-x] [-f [DECIMALS]] [-d] [-p] ty address
```
Dumps a Go value of a given type at a specified address.
**Alias:** god
### Positional arguments
|Positional Argument|Help|

@ -12,6 +12,8 @@ usage: go-type [-h] address
```
Dumps a Go runtime reflection type at a specified address.
**Alias:** goty
### Positional arguments
|Positional Argument|Help|

@ -29,6 +29,8 @@ As a last resort, we sometimes try to explore the addresses in CPU registers and
Memory pages can also be added manually with the use of vmmap-add, vmmap-clear and vmmap-load commands. This may be useful for bare metal debugging.
[0] https://lore.kernel.org/all/20220221030910.3203063-1-dominik.b.czarnota@gmail.com/
**Aliases:** lm, address, vprot, libs
### Positional arguments
|Positional Argument|Help|

@ -12,6 +12,8 @@ usage: down [-h] [n]
```
Select and print stack frame called by this one.
**Aliases:** do, dow
### Positional arguments
|Positional Argument|Help|

@ -12,6 +12,8 @@ usage: dumpargs [-h] [-f]
```
Prints determined arguments for call instruction.
**Alias:** args
### Optional arguments
|Short|Long|Help|

@ -12,6 +12,8 @@ usage: pid [-h]
```
Gets the pid.
**Alias:** getpid
### Optional arguments
|Short|Long|Help|

@ -12,6 +12,8 @@ usage: cpsr [-h] [cpsr_value]
```
Print out ARM CPSR or xPSR register.
**Aliases:** xpsr, pstate
### Positional arguments
|Positional Argument|Help|

@ -12,6 +12,8 @@ usage: setflag [-h] flag value
```
Modify the flags register.
**Alias:** flag
### Positional arguments
|Positional Argument|Help|

@ -25,6 +25,8 @@ With no arguments, uses arguments last specified (with "run" or
use "set args" without arguments.
To start the inferior without using a shell, use "set startup-with-shell off".
**Aliases:** main, init
### Positional arguments
|Positional Argument|Help|

@ -12,6 +12,8 @@ usage: nextjmp [-h]
```
Breaks at the next jump instruction.
**Alias:** nextjump
### Optional arguments
|Short|Long|Help|

@ -12,6 +12,8 @@ usage: nextsyscall [-h]
```
Breaks at the next syscall not taking branches.
**Alias:** nextsc
### Optional arguments
|Short|Long|Help|

@ -12,6 +12,8 @@ usage: stepover [-h] [addr]
```
Breaks on the instruction after this one.
**Alias:** so
### Positional arguments
|Positional Argument|Help|

@ -12,6 +12,8 @@ usage: stepsyscall [-h]
```
Breaks at the next syscall by taking branches.
**Alias:** stepsc
### Optional arguments
|Short|Long|Help|

@ -12,6 +12,8 @@ usage: dds [-h] addr
```
Dump pointers and symbols at the specified address.
**Aliases:** kd, dps, dqs
### Positional arguments
|Positional Argument|Help|

@ -266,6 +266,11 @@ class CommandObj:
self.epilog += "\n" + self.pure_epilog + "\n"
if self.aliases:
alias_txt = "Alias" + ("es" if len(self.aliases) > 1 else "") + ": "
self.epilog += "\n" + message.notice(alias_txt)
self.epilog += ", ".join(self.aliases) + "\n"
# Update the parser so the help is correctly generated.
self.parser.epilog = self.epilog = self.epilog.strip()

@ -120,6 +120,10 @@ def convert_to_markdown(filename: str, command: CommandObj) -> str:
mdFile.insert_code(parser.format_usage(), language="text")
# description
mdFile.new_paragraph(description + "\n")
# aliases
if command.aliases:
alias_txt = "Alias" + ("es" if len(command.aliases) > 1 else "") + ":"
mdFile.write(f"\n**{alias_txt}** " + ", ".join(command.aliases) + "\n")
used_actions = {}
positionals = ["Positional Argument", "Help"]

Loading…
Cancel
Save