Irc-Unix.net

Главная | Actual Topics | Обратная связь | Guest Book | В избранное | Сделать домашней
Категории
 System & Utilities
 Unix News
 OS Emulator
 Developing
 Learning/Education
 Games
 Humour
Каталог статей
Все статьи

Antispam
Статьи
Биллу Гейтсу тоже предлагают избавиться ...
Вымогательство в борьбе со спамом
Календарь

June, 2018
ПнВтСрЧтПтСбВс
123
45678910
11121314151617
18192021222324
252627282930
Опросы
Какой из этих ОС Вы отдаете большее предпочтение?

QNX
FreeBSD
Linux(any)
Solaris
Mac OS
Windows XP
Windows 2003
Что такое ОС? :)


Результаты
Другие опросы

Всего голосов: 326
Комментарии: 0
Ссылки

Архив Новостей
 June 2018 (6)
 May 2018 (10)
 April 2018 (14)
 March 2018 (11)
 February 2018 (13)
 January 2018 (13)
 December 2017 (14)
 November 2017 (15)
 October 2017 (19)
 September 2017 (18)
 August 2017 (13)
 February 2017 (14)
 January 2017 (19)
 December 2016 (16)
 November 2016 (16)
 October 2016 (21)
 September 2016 (18)
 August 2016 (16)
 July 2016 (16)
 June 2016 (20)
 May 2016 (18)
 April 2016 (15)
 March 2016 (22)
 February 2016 (17)
 January 2016 (15)
 December 2015 (15)
 November 2015 (22)
 October 2015 (20)
 September 2015 (17)
 August 2015 (25)
 July 2015 (20)
 June 2015 (23)
 May 2015 (21)
 April 2015 (17)
 March 2015 (19)
 February 2015 (9)
 January 2015 (23)
 December 2014 (9)
 November 2014 (13)
 October 2014 (12)
 September 2014 (18)
 August 2014 (20)
 July 2014 (10)
 June 2014 (12)
 May 2014 (12)
 April 2014 (10)
 March 2014 (22)
 February 2014 (10)
 January 2014 (8)
 December 2013 (26)
 November 2013 (53)
 October 2013 (40)
 September 2013 (48)
 August 2013 (63)
 July 2013 (56)
 June 2013 (52)
 May 2013 (49)
 April 2013 (67)
 March 2013 (74)
 February 2013 (63)
 January 2013 (62)
 December 2012 (62)
 November 2012 (66)
 October 2012 (68)
 September 2012 (48)
 August 2012 (75)
 July 2012 (60)
 June 2012 (71)
 May 2012 (69)
 April 2012 (85)
 March 2012 (86)
 February 2012 (90)
 January 2012 (81)
 December 2011 (103)
 November 2011 (118)
 October 2011 (74)
 September 2011 (2)
 June 2011 (110)
 May 2011 (118)
 April 2011 (111)
 March 2011 (112)
 February 2011 (101)
 January 2011 (119)
 December 2010 (117)
 November 2010 (118)
 October 2010 (131)
 September 2010 (117)
 August 2010 (226)
 July 2010 (351)
 June 2010 (305)
 May 2010 (319)
 April 2010 (343)
 March 2010 (329)
 February 2010 (311)
 January 2010 (312)
 December 2009 (266)
 November 2009 (156)
 July 2009 (101)
 June 2009 (279)
 May 2009 (365)
 April 2009 (348)
 March 2009 (347)
 February 2009 (323)
 January 2009 (318)
 December 2008 (237)
 November 2008 (155)
 October 2008 (334)
 September 2008 (310)
 August 2008 (343)
 July 2008 (362)
 June 2008 (322)
 May 2008 (514)
 April 2008 (1276)
 March 2008 (1658)
 February 2008 (250)
 January 2008 (6)
 November 2007 (1)
 September 2007 (1)
 June 2007 (1)
 May 2007 (1)
 March 2007 (1)
 January 2007 (2)
 December 2006 (1)
 October 2006 (2)
 September 2006 (1)
 August 2006 (2)

Driving Akonadi Next from the command line

System & Utilities

Christian recently blogged about a small command line tool that added to the client demo application a bunch of useful functionality for interacting with Akonadi Next from the command line. This inspired me to reach into my hard drive and pull out a bit of code I'd written for a side project of mine last year and turn up the Akonadi Next command line to 11. Say hello to akonadish.

akonadish supports all the commands Christian wrote about, and adds:

  • piping and file redirect of commands for More Unix(tm)
  • able to be used in stand-alone scripts (#!/usr/bin/env akonadish style)
  • an interactive shell featuring command history, tab completion, configuration knobs, and more

Here's a quick demo of it I recorded this evening (please excuse my stuffy nose ... recovering from a Christmas cold):

We feel this will be a big help for developers, power users and system administrators alike; in fact, we could have used a tool exactly like this for Akonadi with a client just this month ... alas, this only exists for Akonadi Next.

I will continue to develop the tool in response to user need. That may include things like access to useful system information (user name, e.g.?), new Akonadi Next commands, perhaps even that ability to define custom functions that combine multiple commands into one call... it's rather flexible, all-in-all.

Adopt it for your own

Speaking of which, if you have a project that would benefit from something similar, this tool can easily be re-purposed. The Akonadi parts are all kept in their own files, while the functionality of the shell itself is entirely generic. You can add new custom syntax by adding new modules that register syntax which references functions to run in response. A simple command module looks like this:

namespace Example
{

bool hello(const QStringList &args, State &state)
{
state.printLine(\"Hello to you, too!\");
}

Syntax::List syntax()
{
return Syntax::List() << Syntax(\"hello\", QObject::tr(\"Description\"), &Example::hello);
}

REGISTER_SYNTAX(Example)

}

Automcompletion is provided via a lambda assigned to the Syntax object's completer member:

sync.completer = &AkonadishUtils::resourceCompleter;

and sub-commands can be added by adding Syntax object to the children member:

get.children << Syntax(\"debug\", QObject::tr(\"The current debug level from 0 to 6\"), &CoreSyntax::printDebugLevel);

Commands can be run in an event loop when async results are needed by adding the EventDriven flag:

Syntax sync(\"sync\", QObject::tr(\"...\"), &AkonadiSync::sync, Syntax::EventDriven);

and autocompleters can do similarly using the State object passed in which provides commandStarted/commandFinished methods.
... all in all, pretty straightforward. If there is enough demand for it, I could even make it load commands from a plugin that matches the name of the binary (think: ln -s genericappsh myappsh), allowing it to be used entirely generically with little fuss. shrug I doubt it will come to that, but these are the possibilities that float through my head as I wait for compiles to finish. ;)





  


Разместил: Planet KDE | Дата: 29.12.2015 | Прочитано: 473 | Раздел: System & Utilities   

Рейтинг статьи

Средняя оценка: 0.00/0Средняя оценка: 0Всего голосов:0

Отлично
Хорошо Нормально Пойдёт Плохо


Смотрите также связанные темы

19.10.2017 Top 7 open source terminal emulators for Linux
Do you spend a good amount of your time at the command line? These terminal emulators will help make it a better experience. Are you a system administrator, Linux power user, or someone who just spends a lot of time at the command line? Chances are your choice of terminal emulator says something about you.
07.03.2008 shells/p5-Shell-Perl - 0.0015
Shell::Perl is the implementation of a simple command-line interpreter for Perl. WWW: http://search.cpan.org/dist/Shell-Perl/ PR: ports/121142 Submitted by: Shinsuke Matsui <smatsui at karashi.org>
15.04.2008 audio/audiotag - 0.17
Audiotag is a command-line tool for mass tagging/renaming of audio files it supports the vorbis comment, id3 tags, and MP4 tags. WWW: http://www.tempestgames.com/ryan/ PR: ports/122569 Submitted by: Bapt <baptiste.daroussin at gmail.com> Approved by: tabthorpe (mentor)
31.03.2008 devel/mercurial - 1.0
Upgrade to the long-awaited Mercurial 1.0 release! General: * greatly improved merge tool configuration, see "hgrc.5.txt" for details * improved copy/rename handling in diffs, status, and merge * files in .hg inherit permissions from .hg/store * infer --repository when possible, so commands may be run from anywhere. * easy-installable * new "droplet" logo Extensions: * churn: promoted to an official extension (previously in contrib) * color: new extension coloring "status" and "qseries" command outputs * convert: - allow synthetic history to be spliced...
06.03.2008 misc/pastebinit - 0.9
A python script which allows you to use pastebin websites from the command line. PR: ports/120955 Submitted by: comperr <comperr.extra@gmail.com> Approved by: garga (mentor)
20.06.2008 Bringing the trashcan to the command line
By Ben Martin on June 17, 2008 Share Comments The trash project allows you to interact with your desktop trashcan from the command line.
13.12.2008 The Linux CLI for Beginners, or, Fear Not the Linux Command Line
On KDE look in your start menus for Konsole, and on Gnome look for Terminal or Gnome-Terminal. There are dozens of different terminals: xterm, aterm, rxvt, eterm, and many more.
07.02.2009 View Client command line option "-offlineDirectory" does not work correctly (1008460)
When the client command line option -offlineDesktop is used, the desktop is saved in the default location instead of the specified location. To check out a desktop...
17.04.2009 Committing snapshots from within the Service Console (1006847)
  This article provides information related to committing a snapshot that is present in a virtual machine using the command-line in the service console. VMware recommends having free...
28.04.2009 Low swap keeps patches from installing (1010238)
· Low swap keeps patches from installing · Error details similar to the following appear when remediating host with Update Manager or installing the patch via command line with esxupdate: Traceback...
Нет комментариев. Почему бы Вам не оставить свой?
Вы не можете отправить комментарий анонимно, пожалуйста зарегистрируйтесь.
Google Search
Google

Web irc-unix.net

Топ Новостей
1: Linux distros aren\'t updating WebKit, making web browsers and email clients vulnerable
Hot NEWS!
Просмотров - 4962


2: Use ownCloud provided Packages, then VM, then Zip, no distro packages.
Просмотров - 642

3: Akonadi/KMail issues on Tumbleweed?
Просмотров - 611

4: New Year Calligra Words Sprint
Просмотров - 587

5: Netrunner Desktop 16.09 "Avalon" Linux OS Is Out with Kernel 4.7, KDE Plasma 5.7
Просмотров - 581

6: KDevelop 5.0.2 released for Windows and Linux
Просмотров - 552

7: HIG about Simple vs. Advanced Settings
Просмотров - 550

8: Interview with Esfenodon
Просмотров - 526

9: 3.0 Pre-alpha 3 is out!
Просмотров - 496

10: Multi-screen woes in Plasma 5.7
Просмотров - 484

11: Embrace Open Source culture: the 5 common transformations.
Просмотров - 474

12: Driving Akonadi Next from the command line
Просмотров - 472

13: GSoC Update 1: The Beginning
Просмотров - 466

14: [TORRENT] chakra-2016.02-ian-x86_64.iso
Просмотров - 464

15: Fedora and KDE/spin\'s treatment - Discussion
Просмотров - 462

Google 120X240
Ссылки

Главная | Actual Topics | Статьи | Обратная связь | Guest Book
Генерация: 0.899 сек. и 13 запросов к базе данных за 0.841 сек.
Powered by SLAED CMS © 2005-2007 SLAED. All rights reserved.