change name= to id= in <a> tags

This commit is contained in:
arcan1s
2014-08-25 21:31:50 +04:00
parent 494e9994c8
commit 9401cfc315
41 changed files with 296 additions and 296 deletions

View File

@ -8,7 +8,7 @@ title: About zshrc
short: about-zshrc
description: It is first paper in my blog (I think I need something here for tests =)). There are many similar articles, and I'll not be an exception. I just want to show my <code>.zshrc</code> and explain what it does and why it is needed. Also any comments or additions are welcome. It is a translated paper from Russian (<a href="http://archlinux.org.ru/forum/topic/12752/" title="Forum thread">original</a>).
---
<h2><a href="#prepare" class="anchor" name="prepare"><span class="octicon octicon-link"></span></a>Prepare</h2>
<h2><a href="#prepare" class="anchor" id="prepare"><span class="octicon octicon-link"></span></a>Prepare</h2>
<p>First install recommended minima:</p>
{% highlight bash %}
@ -17,7 +17,7 @@ pacman -Sy pkgfile zsh zsh-completions zsh-syntax-highlighting
<p><a href="https://www.archlinux.org/packages/pkgfile/" title="Archlinux package">pkgfile</a> is a very useful utility. Also this command will install shell, additional completion and syntax highlighting.</p>
<h2><a href="#configuration" class="anchor" name="configuration"><span class="octicon octicon-link"></span></a>Shell configuration</h2>
<h2><a href="#configuration" class="anchor" id="configuration"><span class="octicon octicon-link"></span></a>Shell configuration</h2>
<p>All options are avaible <a href="http://zsh.sourceforge.net/Doc/Release/Options.html" title="zsh documentation">here</a>.</p>
<p>Set history file and number of commands in cache of the current session and in the history file:</p>
@ -138,7 +138,7 @@ setopt HIST_REDUCE_BLANKS
source /usr/share/doc/pkgfile/command-not-found.zsh
{% endhighlight %}
<h2><a href="#highlighting" class="anchor" name="highlighting"><span class="octicon octicon-link"></span></a>Syntax highlighting</h2>
<h2><a href="#highlighting" class="anchor" id="highlighting"><span class="octicon octicon-link"></span></a>Syntax highlighting</h2>
{% highlight bash %}
# highlighting
@ -189,7 +189,7 @@ ZSH_HIGHLIGHT_STYLES[double-quoted-argument]='fg=yellow'
<p>In first line highlighting is turned on. Next main, brackets and pattern highlighting are turned on. Patterns are set below (<code>rm -rf *</code> in the example). Also <code>root</code> and <code>cursor</code> highlighting may be turned on. Colors syntax is understandable, <code>fg</code> is font color, <code>bg</code> is background color.</p>
<h2><a href="#prompt" class="anchor" name="prompt"><span class="octicon octicon-link"></span></a>$PROMPT and $RPROMPT</h2>
<h2><a href="#prompt" class="anchor" id="prompt"><span class="octicon octicon-link"></span></a>$PROMPT and $RPROMPT</h2>
<p>The general idea is the use single <code>.zshrc</code> for root and normal user:</p>
{% highlight bash %}
@ -272,7 +272,7 @@ $returncode\
<p>My RPROMPT shows current time, battery change and last returned code. <code>precmd()</code> is necessary for automatic updating. The construct <code>$(if.true.false)</code> is conditional statement in <code>zsh</code>.</p>
<h2><a href="#aliases" class="anchor" name="aliases"><span class="octicon octicon-link"></span></a>Aliases</h2>
<h2><a href="#aliases" class="anchor" id="aliases"><span class="octicon octicon-link"></span></a>Aliases</h2>
<p><b>Copy only those aliases that you need.</b> If any alias uses application that is not installed it will leads to fail of loading of configuration file.</p>
<p>Small useful (or maybe not) function:</p>
@ -364,7 +364,7 @@ alias -g h="| head"
alias -g dn="&> /dev/null &"
{% endhighlight %}
<h2><a href="#functions" class="anchor" name="functions"><span class="octicon octicon-link"></span></a>Functions</h2>
<h2><a href="#functions" class="anchor" id="functions"><span class="octicon octicon-link"></span></a>Functions</h2>
<p>Here is a special function for <code>xrandr</code>:</p>
{% highlight bash %}
@ -522,7 +522,7 @@ yatest () {
}
{% endhighlight %}
<h2><a href="#variables" class="anchor" name="variables"><span class="octicon octicon-link"></span></a>Variables</h2>
<h2><a href="#variables" class="anchor" id="variables"><span class="octicon octicon-link"></span></a>Variables</h2>
<p>It is recommended to set own variables in <code>~/.zshenv</code>. But I have everything stored in the single file.</p>
<p>Here are path, mask of new files, editor and pager:</p>
@ -548,12 +548,12 @@ hash -d u1=/mnt/usbdev1
hash -d u2=/mnt/usbdev
{% endhighlight %}
<h2><a href="#screenshot" class="anchor" name="screenshot"><span class="octicon octicon-link"></span></a>Screenshot</h2>
<h2><a href="#screenshot" class="anchor" id="screenshot"><span class="octicon octicon-link"></span></a>Screenshot</h2>
<p>
{% assign scrdesc = "Zsh demonstation" %}
{% assign scrname = "zshrc_demo" %}
{% include prj_scr.html %}
</p>
<h2><a href="#file" class="anchor" name="file"><span class="octicon octicon-link"></span></a>File</h2>
<h2><a href="#file" class="anchor" id="file"><span class="octicon octicon-link"></span></a>File</h2>
<p><a href="https://raw.github.com/arcan1s/dotfiles/master/zshrc" title="GitHub" type="text/plain">Here is</a> my <code>.zshrc</code>.</p>

View File

@ -8,10 +8,10 @@ title: Building Qutim using Qt5
short: building-qutim-using-qt5
description: <a href="http://qutim.org" title="Qutim Homepage">Qutim</a> is a multiprotocol and cross platform messenger. It is written on <code>CPP</code> using Qt library. The project is actively developed. In this paper I will say about building this package in Archlinux using Qt5 library (instead of Qt4 which is used in current AUR packages).
---
<h2><a href="#problems" class="anchor" name="problems"><span class="octicon octicon-link"></span></a>What's wrong?</h2>
<h2><a href="#problems" class="anchor" id="problems"><span class="octicon octicon-link"></span></a>What's wrong?</h2>
<p>This package uses <a href="http://qt-project.org/wiki/qbs" title="Wiki">qbs</a> for building, which is a bit strange IMHO. A package, which is necessary for building, is <a href="https://aur.archlinux.org/packages/qbs-git/" title="AUR">in AUR </a>. I recommend to use git version of the package. When I asked Andrea Scarpino (who maintains KDE and Qt packages into the official repos) about qbs, he told me "we will support it in time". And I agree with him, the project seems to be a little unstable.</p>
<h2><a href="#prepare" class="anchor" name="prepare"><span class="octicon octicon-link"></span></a>Prepare</h2>
<h2><a href="#prepare" class="anchor" id="prepare"><span class="octicon octicon-link"></span></a>Prepare</h2>
<p>Install dependences. I had used <code>namcap</code>, so maybe I missed something:</p>
{% highlight bash %}
@ -19,7 +19,7 @@ pacman -Sy --asdeps clang git libc++abi qt5-quick1 qt5-x11extras
yaourt -S --asdeps jreen-git qbs-git
{% endhighlight %}
<h3><a href="#qbs" class="anchor" name="qbs"><span class="octicon octicon-link"></span></a>qbs settings</h3>
<h3><a href="#qbs" class="anchor" id="qbs"><span class="octicon octicon-link"></span></a>qbs settings</h3>
<p>You may read about qbs <a href="http://qt-project.org/wiki/qbs" title="Wiki">on the link</a> or see examples which are provides by the package. qbs uses configuration file that firstly you must create and secondly it is stored in your home directory. In theory a configuration file creating ((<code>~/.config/QtProject/qbs.conf</code>)) looks like this:</p>
{% highlight bash %}
@ -74,7 +74,7 @@ qutim\qbs\toolchain=clang, llvm, gcc
<p><a href="/resources/docs/qutim-qt5-git/qbs-qutim.conf" title="File" type="text/plain">qbs-qutim.conf</a></p>
<h3><a href="#patch" class="anchor" name="patch"><span class="octicon octicon-link"></span></a>Patch for sources</h3>
<h3><a href="#patch" class="anchor" id="patch"><span class="octicon octicon-link"></span></a>Patch for sources</h3>
<p>The first problem is <code>clang</code> (at least in Archlinux):</p>
{% highlight diff %}
@ -110,7 +110,7 @@ diff -ruN qutim.orig/protocols/vkontakte/vreen/vreen.qbs qutim/protocols/vkontak
<p><a href="/resources/docs/qutim-qt5-git/qutim-qbs-1.1.patch" title="File" type="text/plain">qutim-qbs-1.1.patch</a></p>
<h3><a href="#sources" class="anchor" name="sources"><span class="octicon octicon-link"></span></a>Get sources</h3>
<h3><a href="#sources" class="anchor" id="sources"><span class="octicon octicon-link"></span></a>Get sources</h3>
{% highlight bash %}
# clone repo
@ -128,7 +128,7 @@ cd ..
patch -p0 -i qutim-qbs-1.1.patch
{% endhighlight %}
<h2><a href="#build" class="anchor" name="build"><span class="octicon octicon-link"></span></a>Building</h2>
<h2><a href="#build" class="anchor" id="build"><span class="octicon octicon-link"></span></a>Building</h2>
{% highlight bash %}
cd qutim
@ -137,7 +137,7 @@ HOME=$(pwd) qbs -j $(nproc) -d ../build release profile:qutim
<p>I want to create a universal recipe for the building, thus we must set <code>$HOME</code> directory. Flag <code>-j</code> means number of jobs, <code>-d</code> means build directory, <code>release</code> means building type (debug, release), <code>profile</code> is used profile, which is described in the configuration file.</p>
<h2><a href="#install" class="anchor" name="install"><span class="octicon octicon-link"></span></a>Installation</h2>
<h2><a href="#install" class="anchor" id="install"><span class="octicon octicon-link"></span></a>Installation</h2>
{% highlight bash %}
HOME=$(pwd) sudo qbs install -d ../build --install-root "/usr" profile:qutim
@ -145,7 +145,7 @@ HOME=$(pwd) sudo qbs install -d ../build --install-root "/usr" profile:qutim
<p>We must set root directory (<code>--install-root</code>), because without this option the package will be installed into <code>/</code> (<code>/bin</code> and <code>/lib</code>).</p>
<h2><a href="#pkgbuild" class="anchor" name="pkgbuild"><span class="octicon octicon-link"></span></a>PKGBUILD</h2>
<h2><a href="#pkgbuild" class="anchor" id="pkgbuild"><span class="octicon octicon-link"></span></a>PKGBUILD</h2>
{% highlight bash %}
pkgname=qutim-qt5-git

View File

@ -8,7 +8,7 @@ title: Site changes
short: site-changes
description: I decided to change my site. You may find short list of changes below.
---
<h2><a href="#list" class="anchor" name="list"><span class="octicon octicon-link"></span></a>The list of changes:</h2>
<h2><a href="#list" class="anchor" id="list"><span class="octicon octicon-link"></span></a>The list of changes:</h2>
<ul>
<li>I rented a <code>arcanis.name</code> domain. Now I have a normal address, as well as all normal people have it. Small description of how to do it. Firstly, you should rent domain and activate DNS editing (it is called <a href="http://www.nic.ru/dns/service/dns_hosting/" title="Service page">DNS-master</a> for Ru-center). I pay about $30 in year. Then you should create CNAME file in your repository; this file has line with your domain name. And finally you should create two DNS records for your domain:

View File

@ -8,7 +8,7 @@ title: Creating own repository
short: creating-custom-repo
description: It is a short paper devoted to creation own ArchLinux repository.
---
<h2><a href="#prepare" class="anchor" name="prepare"><span class="octicon octicon-link"></span></a>Prepare</h2>
<h2><a href="#prepare" class="anchor" id="prepare"><span class="octicon octicon-link"></span></a>Prepare</h2>
<p>First find a server and desire to have sex with it. It is recommended to use Archlinux on it, but it is not necessarily - because you may create special root for Archlinux. Also you need two packages, <code>devtools</code> and <code>pacman</code>:</p>
{% highlight bash %}
@ -57,7 +57,7 @@ fi
<p><code>${REPODIR}/{i686,x86_64}</code> are directories for repository, <code>${PREPAREDIR}</code> is directory where compiled packages will be stored, <code>${STAGINGDIR}</code> is one where packages will be built.</p>
<h2><a href="#theory" class="anchor" name="theory"><span class="octicon octicon-link"></span></a>A bit of theory</h2>
<h2><a href="#theory" class="anchor" id="theory"><span class="octicon octicon-link"></span></a>A bit of theory</h2>
<p>Create directory, share it (using <a href="/en/2014/03/06/site-changes/" title="Site changes paper">ftp</a>, for example). It has two subdirectories - <code>i686</code> and <code>x86_64</code> - for each architecture respectively. And fill them with a set of packages.</p>
<p>Updating repository may be split into the following steps:</p>
@ -74,7 +74,7 @@ fi
<li>Cleaning.</li>
</ol>
<h3><a href="#pkgbuild" class="anchor" name="pkgbuild"><span class="octicon octicon-link"></span></a>Creating PKGBUILDs</h3>
<h3><a href="#pkgbuild" class="anchor" id="pkgbuild"><span class="octicon octicon-link"></span></a>Creating PKGBUILDs</h3>
<p>Download source tarballs from AUR:</p>
{% highlight bash %}
@ -82,7 +82,7 @@ cd "${STAGINGDIR}"
yaourt -G package-name
{% endhighlight %}
<h3><a href="#building" class="anchor" name="building"><span class="octicon octicon-link"></span></a>Packages building</h3>
<h3><a href="#building" class="anchor" id="building"><span class="octicon octicon-link"></span></a>Packages building</h3>
<p>Build each package automatically:</p>
{% highlight bash %}
@ -131,7 +131,7 @@ username ALL=NOPASSWD: /usr/bin/staging-x86_64-build
username ALL=NOPASSWD: /usr/bin/multilib-staging-build
{% endhighlight %}
<h3><a href="#signing" class="anchor" name="signing"><span class="octicon octicon-link"></span></a>Packages signing</h3>
<h3><a href="#signing" class="anchor" id="signing"><span class="octicon octicon-link"></span></a>Packages signing</h3>
{% highlight bash %}
# signing
@ -146,7 +146,7 @@ fi
<p>It is recommended to configure <a href="https://wiki.archlinux.org/index.php/GPG#gpg-agent" title="ArchWiki">gpg-agent</a>.</p>
<h3><a href="#list" class="anchor" name="list"><span class="octicon octicon-link"></span></a>Creating the list of packages</h3>
<h3><a href="#list" class="anchor" id="list"><span class="octicon octicon-link"></span></a>Creating the list of packages</h3>
{% highlight bash %}
# creating packages list
@ -157,7 +157,7 @@ echo -e "${bwhite}[II] ${bblue}=>${cclose} i686 packages: \n${bwhite}${i686_PACK
echo -e "${bwhite}[II] ${bblue}=>${cclose} x86_64 packages: \n${bwhite}${x86_64_PACKAGES}${cclose}"
{% endhighlight %}
<h3><a href="#updating" class="anchor" name="updating"><span class="octicon octicon-link"></span></a>Repository update</h3>
<h3><a href="#updating" class="anchor" id="updating"><span class="octicon octicon-link"></span></a>Repository update</h3>
<p>Here is a function for removal packages from database and repository:</p>
{% highlight bash %}
@ -205,7 +205,7 @@ for PACKAGE in ${x86_64_PACKAGES}; do
done
{% endhighlight %}
<h3><a href="#clear" class="anchor" name="clear"><span class="octicon octicon-link"></span></a>Cleaning</h3>
<h3><a href="#clear" class="anchor" id="clear"><span class="octicon octicon-link"></span></a>Cleaning</h3>
{% highlight bash %}
# clear
@ -215,7 +215,7 @@ cd "${STAGINGDIR}"
/usr/bin/rm -rf *
{% endhighlight %}
<h3><a href="#symlinks" class="anchor" name="symlinks"><span class="octicon octicon-link"></span></a>Creating symlinks</h3>
<h3><a href="#symlinks" class="anchor" id="symlinks"><span class="octicon octicon-link"></span></a>Creating symlinks</h3>
<p>You may want to create a directory, which will contain symlinks on actual packages with names, which does not contain version:</p>
{% highlight bash %}
@ -239,10 +239,10 @@ if [ ${SYMLINK} == "yes" ]; then
fi
{% endhighlight %}
<h3><a href="#file" class="anchor" name="file"><span class="octicon octicon-link"></span></a>File</h3>
<h3><a href="#file" class="anchor" id="file"><span class="octicon octicon-link"></span></a>File</h3>
<p>Here is <a href="https://github.com/arcan1s/repo-scripts" title="GitHub">the scripts</a>. Download source tarballs and run script (editing variables if it is necessary).</p>
<h2><a href="#using" class="anchor" name="using"><span class="octicon octicon-link"></span></a>Repository usage</h2>
<h2><a href="#using" class="anchor" id="using"><span class="octicon octicon-link"></span></a>Repository usage</h2>
<p>Just add following lines to <code>/etc/pacman.conf</code>:</p>
{% highlight bash %}

View File

@ -8,19 +8,19 @@ title: Loveless
short: loveless
description: Here is a small poem from Final Fantasy VII Crisis Core.
---
<h2><a href="#prologue" class="anchor" name="prologue"><span class="octicon octicon-link"></span></a>Prologue</h2>
<h2><a href="#prologue" class="anchor" id="prologue"><span class="octicon octicon-link"></span></a>Prologue</h2>
<p>When the war of the beasts brings about the world's end<br>
The goddess descends from the sky<br>
Wings of light and dark spread afar<br>
She guides us to bliss, her gift everlasting.</p>
<h2><a href="#acti" class="anchor" name="acti"><span class="octicon octicon-link"></span></a>Act I</h2>
<h2><a href="#acti" class="anchor" id="acti"><span class="octicon octicon-link"></span></a>Act I</h2>
<p>Infinite in mystery is the gift of the Goddess<br>
We seek it thus, and take to the sky<br>
Ripples form on the water's surface<br>
The wandering soul knows no rest.</p>
<h2><a href="#actii" class="anchor" name="actii"><span class="octicon octicon-link"></span></a>Act II</h2>
<h2><a href="#actii" class="anchor" id="actii"><span class="octicon octicon-link"></span></a>Act II</h2>
<p>There is no hate, only joy<br>
For you are beloved by the goddess<br>
Hero of the dawn, Healer of worlds<br>
@ -28,7 +28,7 @@ Dreams of the morrow hath the shattered soul<br>
Pride is lost<br>
Wings stripped away, the end is nigh.</p>
<h2><a href="#actiii" class="anchor" name="actiii"><span class="octicon octicon-link"></span></a>Act III</h2>
<h2><a href="#actiii" class="anchor" id="actiii"><span class="octicon octicon-link"></span></a>Act III</h2>
<p>My friend, do you fly away now?<br>
To a world that abhors you and I?<br>
All that awaits you is a somber morrow<br>
@ -38,7 +38,7 @@ Is the bringer of life, the gift of the goddess<br>
Even if the morrow is barren of promises<br>
Nothing shall forestall my return.</p>
<h2><a href="#activ" class="anchor" name="activ"><span class="octicon octicon-link"></span></a>Act IV</h2>
<h2><a href="#activ" class="anchor" id="activ"><span class="octicon octicon-link"></span></a>Act IV</h2>
<p>My friend, the fates are cruel<br>
There are no dreams, no honor remains<br>
The arrow has left, the bow of the goddess<br>
@ -50,7 +50,7 @@ Legend shall speak<br>
Of sacrifice at world's end<br>
The wind sails over the water's surface.</p>
<h2><a href="#actv" class="anchor" name="actv"><span class="octicon octicon-link"></span></a>Act V</h2>
<h2><a href="#actv" class="anchor" id="actv"><span class="octicon octicon-link"></span></a>Act V</h2>
<p>Even if the morrow is barren of promises<br>
Nothing shall forestall my return<br>
To become the dew that quenches the land<br>

View File

@ -8,7 +8,7 @@ title: Apps which I use
short: my-desktop
description: Here is a short paper devoted to the set of applications and extensions that I use everyday on my home computer.
---
<h2><a href="#apps" class="anchor" name="apps"><span class="octicon octicon-link"></span></a>Applications</h2>
<h2><a href="#apps" class="anchor" id="apps"><span class="octicon octicon-link"></span></a>Applications</h2>
<ul>
<li><p><b>Shell</b> is zshrc and nothing else. You may find a small description of my settings <a href="/2014/01/14/about-zshrc/" title="About zshrc paper">here</a>. It is stored <a href="https://raw.githubusercontent.com/arcan1s/dotfiles/master/zshrc" title="File" type="text/plain">here</a> (or <a href="https://raw.githubusercontent.com/arcan1s/dotfiles/master/zshrc_server" title="File" type="text/plain">here</a>).</p></li>
@ -42,7 +42,7 @@ description: Here is a short paper devoted to the set of applications and extens
</ul>
<h2><a href="#kde" class="anchor" name="kde"><span class="octicon octicon-link"></span></a>KDE settings</h2>
<h2><a href="#kde" class="anchor" id="kde"><span class="octicon octicon-link"></span></a>KDE settings</h2>
<div class="thumbnails">
{% assign scrdesc = "KDE screenshot" %}
{% assign scrname = "kde" %}
@ -60,7 +60,7 @@ description: Here is a short paper devoted to the set of applications and extens
{% include prj_scr.html %}
</div>
<h2><a href="#firefox" class="anchor" name="firefox"><span class="octicon octicon-link"></span></a>Firefox settings</h2>
<h2><a href="#firefox" class="anchor" id="firefox"><span class="octicon octicon-link"></span></a>Firefox settings</h2>
<p>I do not use a special settings, thus I get you a list of used add-ons:</p>
<ul>
<li><p><b>Adblock plus</b>.</p></li>

View File

@ -8,15 +8,15 @@ title: Disabling baloo, gentoo-way
short: disabling-baloo
description: Paper, which describes how to remove the dependency on baloo in your system.
---
<h2><a href="#disclaimer" class="anchor" name="disclaimer"><span class="octicon octicon-link"></span></a>Disclaimer</h2>
<h2><a href="#disclaimer" class="anchor" id="disclaimer"><span class="octicon octicon-link"></span></a>Disclaimer</h2>
<p>I do not use this patch, since I prefer less destructive methods. However, apparently all works fine, because there is no any claims. Since this patch was created in a few minutes, it removes all baloo's calls from source files (maybe I'll create a normal patch sometime).</p>
<p>On other hand, I highly recommend to people, who do not use baloo for some reason, disable it from the settings menu (it was added it 4.13.1) or read this <a href="http://blog.andreascarpino.it/disabling-baloo-the-arch-way/" title="Scarpino's blog">article</a>.</p>
<h2><a href="#intro" class="anchor" name="intro"><span class="octicon octicon-link"></span></a>Introduction</h2>
<h2><a href="#intro" class="anchor" id="intro"><span class="octicon octicon-link"></span></a>Introduction</h2>
<p>In Archlinux <b>gwenview</b> and <b>kdepim</b> (and <b>baloo-widgets</b>) depend on baloo currently (2014-05-18). In the version 4.13.0 <b>kactivities</b> depends on baloo too (and I don't know why); but this dependency was not required explicitly, so it was enough just to rebuild the package by removing baloo from the list of dependencies.</p>
<h2><a href="#gwenview" class="anchor" name="gwenview"><span class="octicon octicon-link"></span></a>gwenview</h2>
<h2><a href="#gwenview" class="anchor" id="gwenview"><span class="octicon octicon-link"></span></a>gwenview</h2>
<p>It's all quite simple. Developers have taken care of the wishes of ordinary users and added a special flag:</p>
{% highlight cmake %}
@ -34,8 +34,8 @@ cmake ../gwenview-${pkgver} \
-DGWENVIEW_SEMANTICINFO_BACKEND=None
{% endhighlight %}
<h2><a href="#kdepim" class="anchor" name="kdepim"><span class="octicon octicon-link"></span></a>kdepim</h2>
<h2><a href="#kdepim" class="anchor" id="kdepim"><span class="octicon octicon-link"></span></a>kdepim</h2>
<p>Since everything was done in a hurry, I prefer to look at the source code using grep and to find all references to baloo. Needed strings (they are links to ballo in CMakeLists.txt, baloo's function calls and header declarations) were commented (I added some fake calls to the source code). You may find the patch <a href="https://gist.github.com/arcan1s/b698bb586faef627b3bb" title="Gist">here</a> (4.13.3). Download the patch, apply it to the source code and recompile kdepim.</p>
<h2><a href="#packages" class="anchor" name="packages"><span class="octicon octicon-link"></span></a>Packages</h2>
<h2><a href="#packages" class="anchor" id="packages"><span class="octicon octicon-link"></span></a>Packages</h2>
<p>All Archlinux packages for both architectures may be found in <a href="https://wiki.archlinux.org/index.php/Unofficial_user_repositories#arcanisrepo" title="ArchWiki">my repository</a>.</p>

View File

@ -8,10 +8,10 @@ title: Writting own Shell completions. Zsh
short: writting-own-completions-p1
description: <figure class="img"><img src="/resources/papers/zsh_completion.png" alt="bash_completion"></figure> Some basics of creating a completion files for own application are described in these articles.
---
<h2><a href="#preamble" class="anchor" name="preamble"><span class="octicon octicon-link"></span></a>Preamble</h2>
<h2><a href="#preamble" class="anchor" id="preamble"><span class="octicon octicon-link"></span></a>Preamble</h2>
<p>While developing <a href="/ru/projects/netctl-gui" title="Netctl-gui project page">one of my projects</a> I have wanted to add completion files. I have already tried to create these files, but I was too lazy to read some manuals about it.</p>
<h2><a href="#introduction" class="anchor" name="introduction"><span class="octicon octicon-link"></span></a>Introduction</h2>
<h2><a href="#introduction" class="anchor" id="introduction"><span class="octicon octicon-link"></span></a>Introduction</h2>
<p>There are some possible ways to create zsh completion file. In this article I will describe only one of them, which provides a lot of opportunities, but does not require a lot of costs (such as regular expressions).</p>
<p>Lets consider the example of my application, which has a part of help message that looks like this:</p>
@ -32,7 +32,7 @@ netctl-gui [ -h | --help ] [ -e ESSID | --essid ESSID ] [ -с FILE | --config FI
</ul>
</p>
<h2><a href="#file" class="anchor" name="file"><span class="octicon octicon-link"></span></a>The file pattern</h2>
<h2><a href="#file" class="anchor" id="file"><span class="octicon octicon-link"></span></a>The file pattern</h2>
<p>It must be specified in the header that it is a completion file and application for which it will complete (may be string if this file provides completions for several applications):
{% highlight bash %}
@ -68,7 +68,7 @@ esac
</p>
<h2><a href="#flags" class="anchor" name="flags"><span class="octicon octicon-link"></span></a>Flags</h2>
<h2><a href="#flags" class="anchor" id="flags"><span class="octicon octicon-link"></span></a>Flags</h2>
<p>As it was said above, there are some different ways to create these files. In particular they differ in the flag declaration and their further processing. In my case I will use <code>_arguments</code> command, which require a specific format of variables: <code>FLAG[description]:MESSAGE:ACTION</code>. The last two fields are not required and, as you will see below, are not needed in some cases. If you want to add two flags for an action (short and long format), then the format is a little bit complicated: <code>{(FLAG_2)FLAG_1,(FLAG_1)FLAG_2}[description]:MESSAGE:ACTION</code>. It should be noted that if you want to create completions for two flags but some flags have not a second format. you will should to add following line: <code>{FLAG,FLAG}[description]:MESSAGE:ACTION</code>. <code>MESSAGE</code> is a message which will be shown, <code>ACTION</code> is an action which will be performed after this flag. In this tutorial <code>ACTION</code> will be following: <code>->STATE</code>.</p>
<p>So, according to our requirements, flags declaration will be following:
@ -86,7 +86,7 @@ _netctl_gui_arglist=(
</p>
<h2><a href="#variables" class="anchor" name="variables"><span class="octicon octicon-link"></span></a>Arrays of variables</h2>
<h2><a href="#variables" class="anchor" id="variables"><span class="octicon octicon-link"></span></a>Arrays of variables</h2>
<p>In my case there are two static arrays (which will not be changed):
{% highlight bash %}
@ -111,7 +111,7 @@ _netctl_profiles() {
</p>
<h2><a href="#body" class="anchor" name="body"><span class="octicon octicon-link"></span></a>Function</h2>
<h2><a href="#body" class="anchor" id="body"><span class="octicon octicon-link"></span></a>Function</h2>
<p>Remember, there was something about a state above? It is stored in the variable <code>$state</code> and in this function we will check what it is to choose the appropriate action. At the beginning of the function we should call <code>_arguments</code> with our flags.
{% highlight bash %}
@ -146,7 +146,7 @@ _netctl-gui() {
</p>
<h2><a href="#conclusion" class="anchor" name="conclusion"><span class="octicon octicon-link"></span></a>Conclusion</h2>
<h2><a href="#conclusion" class="anchor" id="conclusion"><span class="octicon octicon-link"></span></a>Conclusion</h2>
<p>File should be places to <code>/usr/share/zsh/site-functions/</code> with any name (it is recommended to set prefix to <code>_</code>). You may found the example <a href="https://raw.githubusercontent.com/arcan1s/netctl-gui/master/sources/gui/zsh-completions" title="File" type="text/plain">in my repository</a>.</p>
<p>The additional information may be found in <a href="https://github.com/zsh-users/zsh-completions" title="GitHub">zsh-completions</a> repository. For example there is this <a href="https://github.com/zsh-users/zsh-completions/blob/master/zsh-completions-howto.org" title="Tutorial">How-To</a>. And also there are a lot of examples.</p>

View File

@ -8,10 +8,10 @@ title: Writting own Shell completions. Bash
short: writting-own-completions-p2
description: <figure class="img"><img src="/resources/papers/bash_completion.png" alt="bash_completion"></figure> Some basics of creating a completion files for own application are described in these articles.
---
<h2><a href="#preamble" class="anchor" name="preamble"><span class="octicon octicon-link"></span></a>Preamble</h2>
<h2><a href="#preamble" class="anchor" id="preamble"><span class="octicon octicon-link"></span></a>Preamble</h2>
<p>While developing <a href="/ru/projects/netctl-gui" title="Netctl-gui project page">one of my projects</a> I have wanted to add completion files. I have already tried to create these files, but I was too lazy to read some manuals about it.</p>
<h2><a href="#introduction" class="anchor" name="introduction"><span class="octicon octicon-link"></span></a>Introduction</h2>
<h2><a href="#introduction" class="anchor" id="introduction"><span class="octicon octicon-link"></span></a>Introduction</h2>
<p>Bash, <a href="/ru/2014/07/17/writting-own-completions-p1" title="Zsh completions paper">unlike zsh</a>, demands some dirty workarounds for completions. Cursory have Googled, I have not found a more or less normal tutorials, so it is based on the available <code>pacman</code> completion files in my system.</p>
<p>Lets consider the example of the same my application. I remind you that a part of help message is as follows:</p>
@ -32,7 +32,7 @@ netctl-gui [ -h | --help ] [ -e ESSID | --essid ESSID ] [ -с FILE | --config FI
</ul>
</p>
<h2><a href="#file" class="anchor" name="file"><span class="octicon octicon-link"></span></a>The file pattern</h2>
<h2><a href="#file" class="anchor" id="file"><span class="octicon octicon-link"></span></a>The file pattern</h2>
<p>Here <b>all</b> variables must return an array. And there no specific formats. First we declare the flags and then we describe all other variables. As I am not going to describe the functions in more detail below I remind you that <code>_netctl_profiles()</code> should be generated each time:
{% highlight bash %}
@ -58,7 +58,7 @@ complete -F _netctl_gui netctl-gui
</p>
<h2><a href="#flags" class="anchor" name="flags"><span class="octicon octicon-link"></span></a>Flags</h2>
<h2><a href="#flags" class="anchor" id="flags"><span class="octicon octicon-link"></span></a>Flags</h2>
<p>As it was said above there is no specific format, so all available flags declare by array:
{% highlight bash %}
@ -79,7 +79,7 @@ _netctl_gui_arglist=(
</p>
<h2><a href="#variables" class="anchor" name="variables"><span class="octicon octicon-link"></span></a>Arrays of variables</h2>
<h2><a href="#variables" class="anchor" id="variables"><span class="octicon octicon-link"></span></a>Arrays of variables</h2>
<p>I just give a function that looked like this in zsh:
{% highlight bash %}
@ -98,7 +98,7 @@ _netctl_profiles() {
</p>
<h2><a href="#body" class="anchor" name="body"><span class="octicon octicon-link"></span></a>Function</h2>
<h2><a href="#body" class="anchor" id="body"><span class="octicon octicon-link"></span></a>Function</h2>
<p>The variable <code>COMPREPLY</code> responds for completion in Bash. To keep track of the current state function <code>_get_comp_words_by_ref</code> must be called with parameters <code>cur</code> (current flag) and <code>prev</code> (previous flag, it is the state). Also some point for case are needed (variables <code>want*</code>). Function <code>compgen</code> is used for completion generation. A list of words is given after flag <code>-W</code>. (Also there is flag <code>-F</code> which requires a function as argument, but it gives warning for me.) The last argument is a current string to which you want to generate completion.</p>
<p>So, here is our function:
@ -140,5 +140,5 @@ _netctl_gui() {
</p>
<h2><a href="#conclusion" class="anchor" name="conclusion"><span class="octicon octicon-link"></span></a>Conclusion</h2>
<h2><a href="#conclusion" class="anchor" id="conclusion"><span class="octicon octicon-link"></span></a>Conclusion</h2>
<p>File should be places to <code>/usr/share/bash-completion/completions/</code> with any name. You may found the example <a href="https://raw.githubusercontent.com/arcan1s/netctl-gui/master/sources/gui/bash-completions" title="File" type="text/plain">in my repository</a>.</p>