aboutsummaryrefslogtreecommitdiffhomepage
path: root/print.html
diff options
context:
space:
mode:
authorjohannst <johannst@users.noreply.github.com>2023-06-26 19:23:26 +0000
committerjohannst <johannst@users.noreply.github.com>2023-06-26 19:23:26 +0000
commit1b251a08f8c10ff292d1ca9b1c580e88df483b94 (patch)
treed208cdef5bb2029909f7f65dede1f20c25acc14e /print.html
parenta85e47072ff808846242da49295b4b73af23b840 (diff)
downloadnotes-1b251a08f8c10ff292d1ca9b1c580e88df483b94.tar.gz
notes-1b251a08f8c10ff292d1ca9b1c580e88df483b94.zip
deploy: e730452fd8bd6824d35f25f2e87b8ec788b626fd
Diffstat (limited to 'print.html')
-rw-r--r--print.html29
1 files changed, 27 insertions, 2 deletions
diff --git a/print.html b/print.html
index 219f8c0..3af14e1 100644
--- a/print.html
+++ b/print.html
@@ -399,8 +399,8 @@ blu -- desc for blu
</code></pre>
<p>where <code>SPEC</code> can have one of the following forms:</p>
<ul>
-<li><code>OPT[DESC]:MSG:ACTION</code></li>
-<li><code>N:MSG:ACTION</code></li>
+<li><code>OPT[DESC]:MSG:ACTION</code> for option flags</li>
+<li><code>N:MSG:ACTION</code> for positional arguments</li>
</ul>
<p>Available actions</p>
<pre><code class="language-zsh">(op1 op2) list possible matches
@@ -437,6 +437,25 @@ function _foo() {
esac
}
</code></pre>
+<h3 id="example-with-optional-arguments"><a class="header" href="#example-with-optional-arguments">Example with optional arguments</a></h3>
+<p>For this example we assume that the command <code>foo</code> takes at least three optional
+arguments such as</p>
+<pre><code class="language-zsh">foo arg1 arg2 arg3 [argN..]
+</code></pre>
+<pre><code class="language-zsh">function _foo() {
+ _arguments \
+ &quot;1:opt 1:(a b c)&quot; \
+ &quot;:opt next:(d e f)&quot; \
+ &quot;*:opt all:(u v w)&quot;
+}
+</code></pre>
+<p>Explanation:</p>
+<ul>
+<li><code>1:MSG:ACTION</code> sets completion for the <strong>first</strong> optional argument</li>
+<li><code>:MSG:ACTION</code> sets completion for the <strong>next</strong> optional argument</li>
+<li><code>*:MSG:ACTION</code> sets completion for the optional argument where none of the
+previous rules apply, so in our example for <code>arg3, argN..</code>.</li>
+</ul>
<blockquote>
<p><code>_files</code> is a zsh builtin utility function to complete files/dirs see</p>
<ul>
@@ -1707,6 +1726,12 @@ instruction pointer (<code>$rip</code> x86) and format as instruction <code>/i</
# Make existing breakpoint conditional
cond 2 if i == 7
</code></pre>
+<h2 id="set-breakpoint-on-all-threads-except-one"><a class="header" href="#set-breakpoint-on-all-threads-except-one">Set breakpoint on all threads except one</a></h2>
+<p>Create conditional breakpoint using the <code>$_thread</code> <a href="https://sourceware.org/gdb/onlinedocs/gdb/Convenience-Vars.html#Convenience-Vars">convenience
+variable</a>.</p>
+<pre><code class="language-markdown"> # Create conditional breakpoint on all threads except thread 12.
+ b foo if $_thread != 12
+</code></pre>
<h2 id="catch-sigsegv-and-execute-commands"><a class="header" href="#catch-sigsegv-and-execute-commands">Catch SIGSEGV and execute commands</a></h2>
<p>This creates a <code>catchpoint</code> for the <code>SIGSEGV</code> signal and attached the <code>command</code>
to it.</p>