diff --git a/_includes/prj_scr.html b/_includes/prj_scr.html
index e6d5abc..a2e9cda 100644
--- a/_includes/prj_scr.html
+++ b/_includes/prj_scr.html
@@ -1,8 +1,8 @@
First install recommended minima: pkgfile is a very useful utility. Also this command will install shell, additional completion and syntax highlighting. All options are avaible here. pkgfile is a very useful utility. Also this command will install shell, additional completion and syntax highlighting. All options are avaible here. Set history file and number of commands in cache of the current session and in the history file: I can not remember all But in this case Command autocomplete: Full command autocomplete will be enabled. Prompt: Enable colors: Here are some other options. Change directory without Correcting of typos (and question template): Disable f#$%ing beep: Enable calculator: Append history (do not recreate the history file): Do not save dups to history file: ...and additional spaces: ...and blank lines too: Enable In first line highlighting is turned on. Next main, brackets and pattern highlighting are turned on. Patterns are set below ( The general idea is the use single Avaible variables are: RPROMPT ( My RPROMPT shows current time, battery change and last returned code. Copy only those aliases that you need. If any alias uses application that is not installed it will leads to fail of loading of configuration file. Small useful (or maybe not) function: Here is the first group of aliases: Here are ls aliases (see man ls): Here are ls aliases (see man ls): Here are aliases to quick file view from console (just type a file name!): Here are "sudo" aliases: Here are global aliases. If they are enable the command Here is a special function for Unfortunately I can not remember Here is a special function for Function that replaces original Functions with automatic rehash after installing/removing packages are: But autocomplete for But autocomplete for It is recommended to set own variables in Here are path, mask of new files, editor and pager: Here is hashes. If they are enable the command
+ {% assign scrdesc = "Zsh demonstation" %}
+ {% assign scrname = "zshrc_demo" %}
+ {% include prj_scr.html %}
+ Here is my Here is my This package uses qbs for building, which is a bit strange IMHO. A package, which is necessary for building, is in AUR . 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. This package uses qbs for building, which is a bit strange IMHO. A package, which is necessary for building, is in AUR . 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. Install dependences. I had used You may read about qbs on the link 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 (( You may read about qbs on the link 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 (( Firstly we find Qt libraries. Then we find toolchains (such as compilers). And next we must insert a toolchain into Qt profile (for example, we need And there are other ways. You may edit the file manually or use So, we have created the configuration file and put it into build directory: The first problem is And the second one is Vk plugin: I want to create a universal recipe for the building, thus we must set We must set root directory ( 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, devtools is script set for building automation in the clean chroot. I think most of Arch maintainers use it. devtools is script set for building automation in the clean chroot. I think most of Arch maintainers use it. Let's create working directories and set colors: Create directory, share it (using ftp, for example). It has two subdirectories - Create directory, share it (using ftp, for example). It has two subdirectories - Updating repository may be split into the following steps: Download source tarballs from AUR: Build each package automatically: It is recommended to add the following lines to It is recommended to configure gpg-agent. It is recommended to configure gpg-agent. Here is a function for removal packages from database and repository: You may want to create a directory, which will contain symlinks on actual packages with names, which does not contain version: Here is the scripts. Download source tarballs and run script (editing variables if it is necessary). Here is the scripts. Download source tarballs and run script (editing variables if it is necessary). Just add following lines to
-When the war of the beasts brings about the world's end When the war of the beasts brings about the world's end Infinite in mystery is the gift of the Goddess There is no hate, only joy My friend, do you fly away now? My friend, the fates are cruel Even if the morrow is barren of promises Shell is zshrc and nothing else. You may find a small description of my settings here. They are stored here (or here). Shell is zshrc and nothing else. You may find a small description of my settings here. It is stored here (or here). DE - I use KDE as Desktop Environment. And that's why most of apps are qt-based. Some KDE settings are below. Graphic editors - gwenview is used for viewing images, kolourpaint is used for simple editing pixel images, gimp (without plugins, since they are not needed for me) - for editing and inkskape is used as editor of vector graphics. Graphic editors - gwenview is used for viewing images, kolourpaint is used for simple editing pixel images, gimp (without plugins, since they are not needed for me) - for editing and inkskape is used as editor of vector graphics. Browser - I use Firefox. Some Firefox settings are below. Chromium is used as additional browser, elinks is used as console browser. IM client is qutIM. It is a cross-platform, multiprotocol and full featured client. Kopete, which I used before it, crashes, does not work correctly and does not work normally with codepage. Also I don't use a console client since I use a tablet IM. And I use Skype for skype obviously. IM client is qutIM. It is a cross-platform, multiprotocol and full featured client. Kopete, which I used before it, crashes, does not work correctly and does not work normally with codepage. Also I don't use a console client since I use a tablet IM. And I use Skype for skype obviously. Mail client is kmail. It is a full featured client (and I use most of them), looks pretty and it is easy to use. If it will be DE-undepended it will be better. Mail client is kmail. It is a full featured client (and I use most of them), looks pretty and it is easy to use. If it will be DE-undepended it will be better. IRC client is konversation. It is a simple IRC client. Though as far as I remember qutIM also supports IRC protocol, I prefre to use a special IRC client. IRC client is konversation. It is a simple IRC client. Though as far as I remember qutIM also supports IRC protocol, I prefre to use a special IRC client. Torrent client is transmission with Qt5 interface (it has gtk interface too). It is also used for server but without GUI. Torrent client is transmission with Qt5 interface (it has gtk interface too). It is also used for server but without GUI. Video player is mpv, since mplayer died and mplayer2 was born deadborn. Graphical frontend are not needed. Video player is mpv, since mplayer died and mplayer2 was born deadborn. Graphical frontend are not needed. Audio player is qmmp. It is a good winamp-like player. Flick of the wrist you may make a handy interface for it (simpleui). Audio player is qmmp. It is a good winamp-like player. Flick of the wrist you may make a handy interface for it (simpleui). Audio/video editors: kdenlive is used as video editor, soundkonverter is used as audio editor, easytag is used for editing audio tags (unfortunately, it is a gtk-based, but I didn't find a better tool for it). And command line and scripts written on bash are used too. Audio/video editors: kdenlive is used as video editor, soundkonverter is used as audio editor, easytag is used for editing audio tags (unfortunately, it is a gtk-based, but I didn't find a better tool for it). And command line and scripts written on bash are used too. Office: Kingsoft Office is used as alternative of Microsoft Office; it has no any feature, but it looks normally, it is qt-based and it is said that it has a good support for standart formats. (Linux version has an alfa stage.) Kile is used as LaTeX frontend. Okular is used as document viewer. And I use GoldenDict as dictionary. Office: Kingsoft Office is used as alternative of Microsoft Office; it has no any feature, but it looks normally, it is qt-based and it is said that it has a good support for standart formats. (Linux version has an alfa stage.) Kile is used as LaTeX frontend. Okular is used as document viewer. And I use GoldenDict as dictionary. Editors: kwrite is used as a simple text editor, kate (and cpp-helper plugin) is used as advanced text editor. And I begin to use atom now. And of cource I use vim in console. Editors: kwrite is used as a simple text editor, kate (and cpp-helper plugin) is used as advanced text editor. And of course I use vim in console. Scientific soft. Chemical visualizers are vmd, chimera and pymol. Physics simulator is step. Calculator is kalgebra and console ipython. Qtiplot is used for drawing graphs and data analysis (scidavis, which is its fork, unfortunately, is half-dead), grace is used for only drawing graphs. Chemtool is used as alternative of ChemDraw. Scientific soft. Chemical visualizers are vmd, chimera and pymol. Physics simulator is step. Calculator is kalgebra and console ipython. Qtiplot is used for drawing graphs and data analysis (scidavis, which is its fork, unfortunately, is half-dead), grace is used for only drawing graphs. Chemtool is used as alternative of ChemDraw. System applications. File manager is dolphin, doublecmd is used as twin-panel manager. Terminal emulators are yakuake and urxvt (as windowed emulator). Archiver graphical interface is ark. System applications. File manager is dolphin, doublecmd is used as twin-panel manager. Terminal emulators are yakuake and urxvt (as windowed emulator). Archiver graphical interface is ark.
+ {% assign scrdesc = "KDE screenshot" %}
+ {% assign scrname = "kde" %}
+ {% include prj_scr.html %}
+ QtCurve is used as Qt style, its settings may be found here, window decorations are presented by QtCurve too. Cursor theme is ecliz-small. Plasma theme is volatile. Icon pack is compass. I use fonts which are based on Liberation. QtCurve is used as Qt style, its settings may be found here, window decorations are presented by QtCurve too. Cursor theme is ecliz-small. Plasma theme is volatile. Icon pack is compass. I use fonts which are based on Liberation. Used widgets (from left to right, top to bottom) are: menubar, homerun with transparent icon, icontask, netctl, default KDE tray, colibri for notifications, pytextmonitor. Used widgets (from left to right, top to bottom) are: menubar, homerun with transparent icon, icontask, netctl, default KDE tray, colibri for notifications, pytextmonitor. As a bonus material here is a settings for konsole bright colors: As a bonus material here is a settings for konsole bright colors.
+ {% assign scrdesc = "Zsh demonstation" %}
+ {% assign scrname = "zshrc_demo" %}
+ {% include prj_scr.html %}
+ I do not use a special settings, thus I get you a list of used add-ons: Adblock plus. I do not use this pacth, 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). 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 article. 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 article. In Archlinux gwenview and kdepim (and baloo-widgets) depend on baloo currently (2014-05-18). In the version 4.13.0 kactivities 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. It's all quite simple. Developers have taken care of the wishes of ordinary users and added a special flag: Thus, we add requred cmake flag to the build script: 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 here (4.13.3). Download the patch, apply it to the source code and recompile kdepim. 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 here (4.13.3). Download the patch, apply it to the source code and recompile kdepim. All Archlinux packages for both architectures may be found in my repository. All Archlinux packages for both architectures may be found in my repository. While developing one of my projects 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. 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). Lets consider the example of my application, which has a part of help message that looks like this:
diff --git a/_posts/2014-01-14-about-zshrc.html b/_posts/2014-01-14-about-zshrc.html
index ab34b1d..603b3be 100644
--- a/_posts/2014-01-14-about-zshrc.html
+++ b/_posts/2014-01-14-about-zshrc.html
@@ -6,19 +6,22 @@ hasTr: true
tags: zshrc, configuration, linux
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 .zshrc and explain what it does and why it is needed. Also any comments or additions are welcome. It is a translated paper from Russian (original).
+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 .zshrc and explain what it does and why it is needed. Also any comments or additions are welcome. It is a translated paper from Russian (original).
---
-Prepare
+Prepare
Shell configuration
-Shell configuration
+Ctrl+ combinations so I bind keys to its default usages:Up/Down arrows are used to navigate through the history based on already entered part of a command. And PgUp/PgDown will ignore already entered part of a command.insert-tab false will enable autocomplete for non-entered commands. max-errors sets maximum number of errors that could be corrected.cd:pkgfile:Syntax highlighting
+Syntax highlighting
+
{% highlight bash %}
# highlighting
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
@@ -159,10 +186,12 @@ ZSH_HIGHLIGHT_STYLES[double-quoted-argument]='fg=yellow'
# root example
#ZSH_HIGHLIGHT_STYLES[root]='bg=red'
{% endhighlight %}
+
rm -rf * in the example). Also root and cursor highlighting may be turned on. Colors syntax is understandable, fg is font color, bg is background color.$PROMPT and $RPROMPT
+$PROMPT and $RPROMPT
.zshrc for root and normal user:fg is font color, bg is background color. _bold and _no_bold regulate the tint. Commands should be in %{ ... %} so they do not appear. Avaible colors are:acpi package is necessary):precmd() is necessary for automatic updating. The construct $(if.true.false) is conditional statement in zsh.Aliases
+Aliases
cat foo g bar will be equivalent the command cat foo | grep bar:Functions
+Functions
xrandr:tar flags thus I use special functions:su:rm command. If you type rm it will be equivalent moving to trash an you can easily restore a file:yaourt -Ss will require root privileges.Variables
+yaourt -Ss will require root privileges.Variables
~/.zshenv. But I have everything stored in the single file.~global will be equivalent the command /mnt/global:Screenshot
-
+Screenshot
+File
-.zshrc.File
+.zshrc.CPP 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).
+description: Qutim is a multiprotocol and cross platform messenger. It is written on CPP 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).
---
-What's wrong?
-What's wrong?
+Prepare
+Prepare
namcap, so maybe I missed something:qbs settings
-~/.config/QtProject/qbs.conf)) looks like this:qbs settings
+~/.config/QtProject/qbs.conf)) looks like this:clang toolchain):qbs-config-ui or qbs-config.Patch for sources
+
+
+Patch for sources
clang (at least in Archlinux):Get sources
+
+
+Get sources
+
{% highlight bash %}
# clone repo
git clone https://github.com/euroelessar/qutim
@@ -116,20 +128,25 @@ cd ..
patch -p0 -i qutim-qbs-1.1.patch
{% endhighlight %}
-Building
+Building
+
{% highlight bash %}
cd qutim
HOME=$(pwd) qbs -j $(nproc) -d ../build release profile:qutim
{% endhighlight %}
+
$HOME directory. Flag -j means number of jobs, -d means build directory, release means building type (debug, release), profile is used profile, which is described in the configuration file.Installation
+Installation
+
{% highlight bash %}
HOME=$(pwd) sudo qbs install -d ../build --install-root "/usr" profile:qutim
{% endhighlight %}
+
--install-root), because without this option the package will be installed into / (/bin and /lib).PKGBUILD
+PKGBUILD
+
{% highlight bash %}
pkgname=qutim-qt5-git
_gitname=qutim
@@ -182,4 +199,5 @@ package() {
HOME="${srcdir}" qbs install -d ../build --install-root "${pkgdir}/usr" profile:qutim
}
{% endhighlight %}
-
+
+
diff --git a/_posts/2014-03-06-site-changes.html b/_posts/2014-03-06-site-changes.html
index c4a6245..77ec6c4 100644
--- a/_posts/2014-03-06-site-changes.html
+++ b/_posts/2014-03-06-site-changes.html
@@ -8,16 +8,19 @@ title: Site changes
short: site-changes
description: I decided to change my site. You may find short list of changes below.
---
-The list of changes:
+The list of changes:
-
diff --git a/_posts/2014-03-23-creating-custom-repo.html b/_posts/2014-03-23-creating-custom-repo.html
index 771086c..cbd71e4 100644
--- a/_posts/2014-03-23-creating-custom-repo.html
+++ b/_posts/2014-03-23-creating-custom-repo.html
@@ -8,13 +8,17 @@ title: Creating own repository
short: creating-custom-repo
description: It is a short paper devoted to creation own ArchLinux repository.
---
-arcanis.name 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 DNS-master 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:
+ arcanis.name 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 DNS-master 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:
+
{% highlight bash %}
@ A 192.30.252.153
@ A 192.30.252.154
# redirection from www.*
www CNAME @
{% endhighlight %}
+
(Symbol @ means you root domain.) And next wait for two hours. You may find out the result as follows:
+
{% highlight bash %}
$ dig domain.name +nostats +nocomments +nocmd
; <<>> DiG 9.9.2-P2 <<>> domain.name +nostats +nocomments +nocmd
@@ -26,9 +29,11 @@ $ dig domain.name +nostats +nocomments +nocmd
domain.name. 912 IN A 192.30.252.153
domain.name. 912 IN A 192.30.252.154
...
-{% endhighlight %}anon_world_readable_only=YES are used for prevent access to the music directory.
Also here is my /etc/vsftpd.conf configuration file:
+
{% highlight bash %}
anonymous_enable=YES
anon_root=/srv/ftp
@@ -62,6 +69,7 @@ Now let's add redirection from repo.arcanis.name to the needed IP a
{% highlight bash %}
repo A 89.249.170.38
{% endhighlight %}
+
Prepare
+Prepare
devtools and pacman:${REPODIR}/{i686,x86_64} are directories for repository, ${PREPAREDIR} is directory where compiled packages will be stored, ${STAGINGDIR} is one where packages will be built.A bit of theory
-i686 and x86_64 - for each architecture respectively. And fill them with a set of packages.A bit of theory
+i686 and x86_64 - for each architecture respectively. And fill them with a set of packages.
-Creating PKGBUILDs
+Creating PKGBUILDs
Packages building
+Packages building
/etc/sudoers:Packages signing
+Packages signing
+
{% highlight bash %}
# signing
if [ ${USEGPG} == "yes" ]; then
@@ -132,9 +142,11 @@ if [ ${USEGPG} == "yes" ]; then
done
fi
{% endhighlight %}
-Creating the list of packages
+Creating the list of packages
+
{% highlight bash %}
# creating packages list
cd "${PREPAREDIR}"
@@ -144,15 +156,18 @@ 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 %}
-Repository update
+Repository update
i686 repository update:x86_64 repository update:Cleaning
+Cleaning
+
{% highlight bash %}
# clear
cd "${PREPAREDIR}"
@@ -196,8 +214,9 @@ cd "${STAGINGDIR}"
/usr/bin/rm -rf *
{% endhighlight %}
-Creating symlinks
+Creating symlinks
File
-File
+Repository usage
+Repository usage
/etc/pacman.conf:Prologue
-
+Prologue
+
The goddess descends from the sky
Wings of light and dark spread afar
She guides us to bliss, her gift everlasting.Act I
+Act I
We seek it thus, and take to the sky
Ripples form on the water's surface
The wandering soul knows no rest.Act II
+Act II
For you are beloved by the goddess
Hero of the dawn, Healer of worlds
Dreams of the morrow hath the shattered soul
Pride is lost
Wings stripped away, the end is nigh.Act III
+Act III
To a world that abhors you and I?
All that awaits you is a somber morrow
@@ -35,7 +34,7 @@ My friend, your desire
Is the bringer of life, the gift of the goddess
Even if the morrow is barren of promises
Nothing shall forestall my return.Act IV
+Act IV
There are no dreams, no honor remains
The arrow has left, the bow of the goddess
@@ -46,7 +45,7 @@ And your eternal slumber
Legend shall speak
Of sacrifice at world's end
The wind sails over the water's surface.Act V
+Act V
Nothing shall forestall my return
To become the dew that quenches the land
diff --git a/_posts/2014-05-07-my-desktop.html b/_posts/2014-05-07-my-desktop.html
index f909edb..64cd1fd 100644
--- a/_posts/2014-05-07-my-desktop.html
+++ b/_posts/2014-05-07-my-desktop.html
@@ -8,53 +8,59 @@ 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.
---
-Applications
+Applications
-
-KDE settings
-
+KDE settings
+
-
Firefox settings
+Firefox settings
Disclaimer
+Disclaimer
Introduction
+Introduction
gwenview
+gwenview
kdepim
-kdepim
+Packages
-Packages
+
Some basics of creating a completion files for own application are described in these articles.
+description: 
Preamble
+Preamble
Introduction
+Introduction
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 %} @@ -65,9 +65,10 @@ case "$service" in ;; esac {% endhighlight %} +
-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 _arguments command, which require a specific format of variables: FLAG[description]:MESSAGE:ACTION. 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: {(FLAG_2)FLAG_1,(FLAG_1)FLAG_2}[description]:MESSAGE:ACTION. 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: {FLAG,FLAG}[description]:MESSAGE:ACTION. MESSAGE is a message which will be shown, ACTION is an action which will be performed after this flag. In this tutorial ACTION will be following: ->STATE.
So, according to our requirements, flags declaration will be following: @@ -82,9 +83,10 @@ _netctl_gui_arglist=( {'--set-opts','--set-opts'}'[set options for this run, comma separated]:comma separated:->settings' ) {% endhighlight %} +
-In my case there are two static arrays (which will not be changed): {% highlight bash %} @@ -106,9 +108,10 @@ _netctl_profiles() { print $(find /etc/netctl -maxdepth 1 -type f -printf "%f\n") } {% endhighlight %} +
-Remember, there was something about a state above? It is stored in the variable $state and in this function we will check what it is to choose the appropriate action. At the beginning of the function we should call _arguments with our flags.
{% highlight bash %}
@@ -140,9 +143,10 @@ _netctl-gui() {
esac
}
{% endhighlight %}
+
File should be places to /usr/share/zsh/site-functions/ with any name (it is recommended to set prefix to _). You may found the example in my repository.
File should be places to /usr/share/zsh/site-functions/ with any name (it is recommended to set prefix to _). You may found the example in my repository.
The additional information may be found in zsh-completions repository. For example there is this How-To. And also there are a lot of examples.
+The additional information may be found in zsh-completions repository. For example there is this How-To. And also there are a lot of examples.
diff --git a/_posts/2014-07-17-writting-own-completions-p2.html b/_posts/2014-07-17-writting-own-completions-p2.html index f5354a8..decb1a1 100644 --- a/_posts/2014-07-17-writting-own-completions-p2.html +++ b/_posts/2014-07-17-writting-own-completions-p2.html @@ -6,13 +6,13 @@ layout: paper tags: linux, development title: Writting own Shell completions. Bash short: writting-own-completions-p2 -description:
Some basics of creating a completion files for own application are described in these articles.
+description: 
While developing one of my projects 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.
+While developing one of my projects 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.
-Bash, unlike zsh, 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 pacman completion files in my system.
Bash, unlike zsh, 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 pacman completion files in my system.
Lets consider the example of the same my application. I remind you that a part of help message is as follows:
@@ -32,7 +32,7 @@ netctl-gui [ -h | --help ] [ -e ESSID | --essid ESSID ] [ -с FILE | --config FI -Here all 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 _netctl_profiles() should be generated each time:
{% highlight bash %}
@@ -55,9 +55,10 @@ And finally again without isolation in a separate function we create a de
{% highlight bash %}
complete -F _netctl_gui netctl-gui
{% endhighlight %}
+
As it was said above there is no specific format, so all available flags declare by array: {% highlight bash %} @@ -75,9 +76,10 @@ _netctl_gui_arglist=( '--set-opts' ) {% endhighlight %} +
-I just give a function that looked like this in zsh: {% highlight bash %} @@ -93,9 +95,10 @@ _netctl_profiles() { echo $(find /etc/netctl -maxdepth 1 -type f -printf "%f\n") } {% endhighlight %} +
-The variable COMPREPLY responds for completion in Bash. To keep track of the current state function _get_comp_words_by_ref must be called with parameters cur (current flag) and prev (previous flag, it is the state). Also some point for case are needed (variables want*). Function compgen is used for completion generation. A list of words is given after flag -W. (Also there is flag -F 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.
So, here is our function: @@ -134,7 +137,8 @@ _netctl_gui() { true } {% endhighlight %} +
-File should be places to /usr/share/bash-completion/completions/ with any name. You may found the example in my repository.
File should be places to /usr/share/bash-completion/completions/ with any name. You may found the example in my repository.
The Trusted User (TU) is a member of the community charged with keeping the AUR in working order. He/she maintains popular packages (communicating with and sending patches upstream as needed), and votes in administrative matters. A TU is elected from active community members by current TUs in a democratic process. TUs are the only members who have a final say in the direction of the AUR.-
+
© ArchWiki