Move under www to ease rsync
This commit is contained in:
139
www/eps/hpr2443/hpr2443_full_shownotes.html
Executable file
139
www/eps/hpr2443/hpr2443_full_shownotes.html
Executable file
@@ -0,0 +1,139 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="generator" content="pandoc">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
||||
<meta name="author" content="Dave Morriss">
|
||||
<title>pdmenu (HPR Show 2443)</title>
|
||||
<style type="text/css">code{white-space: pre;}</style>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link rel="stylesheet" href="http://hackerpublicradio.org/css/hpr.css">
|
||||
</head>
|
||||
|
||||
<body id="home">
|
||||
<div id="container" class="shadow">
|
||||
<header>
|
||||
<h1 class="title">pdmenu (HPR Show 2443)</h1>
|
||||
<h2 class="author">Dave Morriss</h2>
|
||||
<hr/>
|
||||
</header>
|
||||
|
||||
<main id="maincontent">
|
||||
<article>
|
||||
<header>
|
||||
<h1>Table of Contents</h1>
|
||||
<nav id="TOC">
|
||||
<ul>
|
||||
<li><a href="#introduction">Introduction</a></li>
|
||||
<li><a href="#installation">Installation</a></li>
|
||||
<li><a href="#running-pdmenu">Running <code>pdmenu</code></a></li>
|
||||
<li><a href="#the-configuration-file">The configuration file</a><ul>
|
||||
<li><a href="#example">Example</a></li>
|
||||
<li><a href="#dynamic-menus">Dynamic menus</a></li>
|
||||
</ul></li>
|
||||
<li><a href="#links">Links</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
</header>
|
||||
<h2 id="introduction">Introduction</h2>
|
||||
<p><a href="https://joeyh.name/code/pdmenu/" title="Pdmenu"><code>Pdmenu</code></a> is a tool written by <a href="https://joeyh.name/" title="Joey Hess">Joey Hess</a> which allows the creation of a simple menu in a terminal (console) window. It is in his list of less active projects, and the latest version is dated 2014, but it seems to be quite complete and useful as it is.</p>
|
||||
<p>I like simple menus. As a Sysadmin in my last job I used one on the OpenVMS system I managed which helped me run the various periodic tasks I needed to run - especially the less frequent ones - without having to remember all of the details.</p>
|
||||
<p>I do the same on my various Linux systems, and find that <code>pdmenu</code> is ideal for the task.</p>
|
||||
<h2 id="installation">Installation</h2>
|
||||
<p>I found <code>pdmenu</code> in the Debian repositories (I run Debian Testing), and it was very easily installed. The C source is available as a tarfile, though I haven’t tried building it myself.</p>
|
||||
<h2 id="running-pdmenu">Running <code>pdmenu</code></h2>
|
||||
<p>Simply typing <code>pdmenu</code> at a command prompt will invoke the utility. It uses the file <code>/etc/pdmenurc</code> as its default configuration file, and this generates a menu with a demonstration of some of its features.</p>
|
||||
<p>This is not particularly useful but it can be overridden by creating your own configuration, which by default is in <code>~/.pdmenurc</code>. The <code>pdmenu</code> command itself takes a configuration file as an argument, so there is plenty of flexibility.</p>
|
||||
<h2 id="the-configuration-file">The configuration file</h2>
|
||||
<h3 id="example">Example</h3>
|
||||
<p>I use the <code>~/.pdmenurc</code> file at present, so I will talk about that. This file contains definitions (commands) that look like this example from the <code>pdmenu</code> manual page:</p>
|
||||
<pre><code>#Set a pleasing color scheme.
|
||||
color:desktop:blue:blue
|
||||
color:title:blue:white
|
||||
color:base:blue:white
|
||||
|
||||
#this is a comment
|
||||
menu:main:Main Menu:Things to do at foobar
|
||||
show:_Games..::games
|
||||
exec:_Mail::pine
|
||||
exec:_News::slrn -C
|
||||
exec:_WWW::lynx
|
||||
exec:_Irc::irc
|
||||
exec:_Directory Listing:display:ls -l
|
||||
exec:_Who's online?:truncate:w
|
||||
exec:_Finger:edit,truncate:finger ~finger who?:~
|
||||
nop
|
||||
exit:E_xit
|
||||
|
||||
menu:games:Games:Some text-based games
|
||||
exec:_Tetris for Terminals::/usr/games/tt
|
||||
exec:_Adventure:pause:/usr/games/adventure
|
||||
exec:_Zork:pause:/usr/games/zork
|
||||
nop
|
||||
exit:_Back to main menu..</code></pre>
|
||||
<ul>
|
||||
<li>The first block of lines use <code>color</code> commands to set the colours of the menu display.</li>
|
||||
<li><p>The next block defines a menu with the <code>menu</code> command. The menu’s internal name is <code>main</code>, and its title is ‘Main Menu’. The text “Things to do at foobar” is displayed at the bottom of the screen as help text.</p>
|
||||
<ul>
|
||||
<li>The first item in the menu is a link to another menu called ‘Games’ which is defined later in the file.</li>
|
||||
<li>The underscore before the ‘G’ makes it a hot-key which is highlighted</li>
|
||||
<li>The <code>exec</code> command makes a menu entry which runs a command</li>
|
||||
<li>The <code>nop</code> command leaves a line in the menu (with optional text)</li>
|
||||
<li>The <code>exit</code> command exits the current menu to the level above</li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
<p><img src="hpr2443_example1_1.png" alt="Example of the menu 1" /> <img src="hpr2443_example1_2.png" alt="Example of the menu 2" /><br />
|
||||
<small>Top level menu and sub-menu from the above example</small></p>
|
||||
<p>There is quite a lot more to be said about <code>pdmenu</code> but I’ll leave you to investigate further if it seems interesting to you.</p>
|
||||
<p>However, I will mention the <code>group</code> command and how it can be used to create dynamic menus, just to give you some idea of the power and flexibility of this utility.</p>
|
||||
<h3 id="dynamic-menus">Dynamic menus</h3>
|
||||
<p>I am using <code>pdmenu</code> to help manage various administrative tasks I do for HPR. The latest menu I have built helps me intercept the notes from newly uploaded shows, which I check and edit if necessary, generate HTML if needed and then upload the result for incorporation.</p>
|
||||
<p>I use a number of scripts for all of this which I will not go into here. I get <a href="http://hackerpublicradio.org/eps.php?id=2173" title="hpr2173 :: Driving a Blinkt! as an IoT device">alerted</a> when a new show is in the process of being uploaded. I have a tool that checks to see if the upload has finished, and when it is complete I grab the notes and save a local copy. I then process these notes as necessary.</p>
|
||||
<p>Here is the menu definition:</p>
|
||||
<pre><code>menu:showsubmission:HPR Show Submission:Deal with incoming shows
|
||||
exec:_Show status:pause:~/HPR/Show_Submission/NS_test
|
||||
exec:_Rsync new show notes::~/HPR/Show_Submission/sync_hpr
|
||||
exec:_Copy notes:pause:~/HPR/Show_Submission/copy_shownotes
|
||||
nop:--
|
||||
group:_Process unprocessed shownotes
|
||||
exec::makemenu:~/HPR/Show_Submission/makemenu
|
||||
show:Process notes::process
|
||||
remove:::process
|
||||
endgroup
|
||||
nop:--
|
||||
exit:E_xit HPR Show Submission</code></pre>
|
||||
<p>The interesting bit is the <code>group</code> command. It invokes an <code>exec</code> with the <code>makemenu</code> flag. This takes the output of the group and makes a menu out of it. I call a script I wrote called <code>makemenu</code> (not very originally!) which works out which files need processing and offers a menu to do it. The menu is called <code>process</code>, and the <code>show</code> command is used to display it. Once finished the menu is deleted with the <code>remove</code> command.</p>
|
||||
<p>I have made an example using dummy show number 2465 to demonstrate the base menu and the dynamically generated sub-menu. I’m using the same colours as the previous example.</p>
|
||||
<p><img src="hpr2443_example2_1.png" alt="Example of the base menu" /> <img src="hpr2443_example2_2.png" alt="Example of the sub-menu" /><br />
|
||||
<small>Top level menu and sub-menu from my <code>pdmenu</code> menu</small></p>
|
||||
<p>Here’s what my <code>makemenu</code> script generates to make the sub-menu:</p>
|
||||
<pre><code>$ ./makemenu
|
||||
menu:process:Process notes for 2465:Process notes for 2465
|
||||
exec:Show _raw (2465):pause:~/HPR/Show_Submission/do_show 2465
|
||||
exec:_Parse raw (2465):pause:~/HPR/Show_Submission/do_parse 2465
|
||||
exec:_Edit notes (2465):pause:~/HPR/Show_Submission/do_vim 2465
|
||||
exec:Run _Pandoc (2465):pause:~/HPR/Show_Submission/do_pandoc 2465
|
||||
exec:Run _Midori (2465):pause:~/HPR/Show_Submission/do_midori 2465
|
||||
exec:_Upload HTML (2465):pause:~/HPR/Show_Submission/do_upload 2465
|
||||
exit:E_xit processing for 2465</code></pre>
|
||||
<p>This system is under development so may well change in the light of experience.</p>
|
||||
<h2 id="links">Links</h2>
|
||||
<ul>
|
||||
<li><a href="https://joeyh.name/code/pdmenu/">Pdmenu website</a></li>
|
||||
<li><a href="https://joeyh.name/">Joey Hess</a></li>
|
||||
<li>Resources:
|
||||
<ul>
|
||||
<li><a href="hpr2443_full_shownotes.html">Long notes for this episode</a></li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
<!--
|
||||
vim: syntax=markdown:ts=8:sw=4:ai:et:tw=78:fo=tcqn:fdm=marker
|
||||
-->
|
||||
</article>
|
||||
</main>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user