Episode: 2443
Title: HPR2443: pdmenu
Source: https://hub.hackerpublicradio.org/ccdn.php?filename=/eps/hpr2443/hpr2443.mp3
Transcribed: 2025-10-19 03:08:15

---

This episode of HPR is brought to you by archive.org.
Support universal access to all knowledge by heading over to archive.org forward slash donate.
Support universal access to all knowledge by heading over to archive.org.
Support universal access to all knowledge by heading over to archive.org.
Support universal access to all knowledge by heading over to archive.org.
Support universal access to all knowledge by heading over to archive.org.
Hello everybody. Welcome to Hackup Public Radio. My name is Dave Morris and I'm doing a show today entitled PD Menu.
This is a tool which is written by a guy who I'd heard of before called Joey Hess.
There's details of him in my notes and it allows you to create a simple menu in a terminal or console in such a window.
It is in his list of less active projects and the latest version I can see on his website is dated 2014.
I guess that just means he'd pretty much finished it, put all the features in that he reckoned to be necessary.
I certainly find it complete and very useful as it is.
So I quite like simple menus and I used to be a cis admin.
In my last job and I ran OpenVMS system quite a long time or several OpenVMS systems and I had lots of management tasks to do on it which I grouped together into menus just because it saved me forgetting things.
I had them built into menus. Obviously I built them into scripts as well but the menus were useful just so I didn't have to remember the names of scripts and where they were and all that sort of thing.
I certainly found it helped me with the less frequent tasks I had to do because my memory ain't that wonderful and I would forget all of the bits and pieces.
Well the same applies, my memory hasn't got better since I stopped working and so I have a menu, I like to have a menu to run things on my Linux system.
You can write menus yourself but Joey here has already done the job and he's done a good job I think.
PD menu is available in the Debian repository. I'm a Debian testing user and it was easily installed.
I imagine it's in all of the Debian derivatives. I imagine it's in many others as well but I haven't actually done a search.
The C source is available from his website as a tar file of the usual sort with auto-conf and stuff to build it.
I haven't tried building it myself but I imagine it's pretty straightforward. There are some dependencies as usual but nothing very well-chattering.
So when you run it the first time you install it you might run it type PD menu at command prompt and you will get a menu.
It uses the file slash ETC slash PD menu RC as a default configuration file and that just contains really some mildly useful menu definitions.
But it's more of a demonstration of features and something you can go and look at to see how it works.
It's got a good man page and there's also a man page for the configuration file and it's PD menu RC.
You can create your own dot PD menu RC in your home directory and that's where you put all the configuration stuff.
You can create loads of these files wherever you want to and you can put them on the command line as an argument to PD menu if you want to.
I personally just use the one file and it's got loads of menus from different contexts.
So let's look at the PD menu RC file and the various things you can put there.
It tends to be called commands in this context and I've got an example. It's just taken from the PD menu manual page.
What I did was I grabbed a copy of this and put it in a file and then ran PD menu against it and I've got the listing.
You can see in the man page as well of course and I've got brief explanation which I'll go through in a moment and there are two screen shots of the menu running just to give you some idea of what it looks like and what it is.
You might look at this and go, yeah, I'm not using this because if you're a Windows-based person it's probably not the thing you want.
I tend to be more command line oriented but this thing is a primitive window type thing which appeals to me.
So there's a bunch of commands in the example. There's a bunch of color commands which set various aspects of the whole thing, the desktop, the title, the base.
There's a whole list of them which I won't go into but the color effect that it produces you'll see in my screen shots.
Then there's a menu and that is introduced with the command menu and the menu has a name. You refer to it actually in the menu file in the configuration file if you want to.
We can refer to it outside when you call PD menu RC and it's got things like a title for the menu and it's got help text.
The help text is shown at the bottom of your screen so it's just a single line.
The first line after the menu, the lines that follow it are entries if you like for the menu until you hit another menu generating command.
The first one is show followed by various things including the name of another menu. There's a second menu in the example which can be invoked from the first because that's what you often do with menus.
Other than that there are various exec commands which make a menu entries where you can run command. You can even run little bash scripts, just inline bash pipelines and so forth.
You can extend these things with backslashes to the umpteenth degree if you want to.
Now don't do things that way because it makes the config file really ugly but these are some fairly basic things.
These are obviously related to somebody who has quite a lot of command line type features. I haven't used pine for years.
I don't use net news or anything like that. Don't use links. Certainly don't use IRC in that form.
But anyway you can see the sort of general things that you'd want to do. There's an example in there of using an entry which prompts you for input and that's in order to use the finger command which you'd probably never ever use.
I certainly haven't used that for many many years but it's you know so useful example.
The NOP command not nor no op is just a way of leaving blank lines in the menu.
You can follow it with a bit of text if you want to just to have some have a line of hyphen or something and the exit command exits from the current menu to the level above.
So if you're in the sub menu it exits back to the main menu and if you're in the top level menu it exits back to command line.
So nothing really well chattering here. I could talk a lot more about the commands that you put in the config file. There's quite a lot of information in the man page but I'm not going to go into that much detail here because if you're interested you can do the research yourself quite easily.
I think you'll find however I thought it might be useful just to refer to a thing I did recently over the weekend setting up a menu where I used a thing to generate dynamic menus.
So the menu is different each time you use it. There are also some examples with PD menu which show examples of menus you can generate on the fly as well.
So let's look at my dynamic menu briefly and the point of it is that I'm using PD menu to help me do various administrative tasks for HPR.
And the latest menu I created for myself was to help me intercept the notes associated with newly uploaded HPR shows.
So I've taken on the task of checking these and editing them. Sometimes they're plain text and we really need HTML so I turn the plain text into HTML by various means.
And then once I've generated the HTML I upload it. People who send in HTML themselves I usually just double check it that it's syntactically correct and then upload it.
These are a bunch of reasonably straightforward things that I do but it's useful to have a menu to sort of have to remember that after doing A I don't need to do B.
I guess I'm getting all I can't remember things as well as I used to. There's a whole bunch of scripts which I used to do this but I'm not going to go into details of that just now.
Now as you might know if you've heard others of my shows I get an alert when a new show is in the process of actually in the process of being uploaded because it scrapes the website.
I did a show on all of this sort of stuff and I've put a link to it if you're interested because I've got an LED display thing that turns on when there's some work to do.
So since I catch the uploads as they start they might not yet be finished so I have a tool which lets me check to see if the uploads done yet.
And then when it's done I collect the notes and keep a local copy then I process them. I actually have a chronic job that goes and clears away notes after a few weeks.
It's useful to have them around for a while just in case I need to re-edit something or make some correction or prepare things for the upload to archive.org at some point.
Anyway I've included my menu definition for this thing and it just consists of a menu called Show Submission. It's not got very many entries.
It shows this particular command which I call Show Status which is check and see whether the thing's uploaded then there's an entry which kicks off the thing that grabs the notes and so forth.
I don't want to go into details with this here. You're probably not interested anyway to know too much about this.
What I've done is I've run it and I've demonstrated what it looks like with a couple of screenshots but in particular I've shown the dynamic menu which I think is the interesting piece.
So in order to do this there's a command for the config file called Group and this allows you to group a bunch of commands together in order to do something more complex than just a simple exec command.
In this group I'm using the exec command with a flag and the flag is Make Menu.
What this allows you to do is to run something either a bit of bash scripting or in my particular case a script which generates the commands for a menu.
So with singular lack of originality I called the script which I invoke Make Menu and what it actually does behind the scenes is it goes to this is assuming that a new show has come in.
When this thing is run it finds the details that I've processed with the earlier bits of the top level menu.
It makes a bunch of commands that I need to run on this particular show in order to get it ready for upload.
If there was several of them came in at once then it just takes the first one off the stack as it were and when that's been dealt with I can run it again and it brings the next one in and so forth.
So you'll see in the group looking at the definition there's this exec make menu thing then there's a show command show is a thing that used to show a menu which is a menu that might be somewhere else in the file or in this particular case it's one that's been generated dynamically.
Its name is processed but you can't tell that just just from here it's the fact that is that the script that creates it calls it that could have been an argument to actually I could have made different ones see the need.
Then when it's been shown you use it when you exit it then the remove command that follows deletes that menu.
So it's actually held in memory until you do that and if you re-invoked it you'd see the menu plus a call to make menu second call to make menu which would be another menu so the menu would be doubled so you need to do the remove in order to do so.
The group ends with an in group line and that's pretty much all there is to it.
I thought I'd just run the make menu script where you can see what the menu looks like when in my screenshot it I made a dummy show number 2465 just to demonstrate this the cron job actually spotted spots these these things.
This is our real show and deletes it when I'm doing these tests which is amusing and it shows a menu specifically for dealing with this show.
There's a list of things that you can do with it. Look at the raw data and pause the bits out of it and I'm interested in edit it, run pandog against it, show it in a web browser and then upload it.
So the final bit is I ran my make menu script just from the command line so you can see what sort of things it generates and surprise surprise it generates a bunch of commands for the PD menu RC or the config file which consists of a menu and a list of execs and an exit and so forth.
Not world-shattering at all. There's a few nuances here which I won't go into but the making of menus specific to your needs is done with relative ease.
That's why I think PD menu is quite clever and is pretty useful. You don't need to do a huge amount of work in order to make something that's quite useful or least useful in my definition of useful.
Anyway, I hope you found that interesting. There are links here that you can go and examine if you did and want to follow up.
Okay, that's it then. Bye.
You've been listening to HecopobliGradio at HecopobliGradio.org. We are a community podcast network that releases shows every weekday, Monday through Friday.
Today's show, like all our shows, was contributed by an HPR listener like yourself. If you ever thought of recording a podcast and click on our contributing to find out how easy it really is.
HecopobliGradio was founded by the Digital Dog Pound and the Infonomicon Computer Club and is part of the binary revolution at binrev.com.
If you have comments on today's show, please email the host directly, leave a comment on the website or record a follow-up episode yourself.
Unless otherwise status, today's show is released on the creative comments, attribution, share a life, 3.0 license.
