Open CL help,man, info, tldr in a graphical text editor

Message
Author
advice1010
Posts: 349
Joined: Tue Feb 21, 2023 3:50 pm

Open CL help,man, info, tldr in a graphical text editor

#1 Post by advice1010 »

I was wondering if it was possible to be able to load information generated by the following, into a graphical text editor such as Geany or Featherpad which would allow the ability to do word searches and also would just be easier to navigate. Ideally I would like to use one of these two programs mentioned above if possible.

Items that load information
--help
man
info
tldr

Main ones I would be looking for are --help & man.

I have looked this up and I saw someone mention you can pipe the information, I also saw someone mention you could actually load into your web browser which I did not try yet. I also saw there are programs spefically for loading man pages, but again would prefer one of the two text editors I already have.

So far I was able to pass the manual & help for the ls command into a text file, for example

Code: Select all

man ls > /tmp/man.txt && featherpad /tmp/man.txt

Code: Select all

ls --help > /tmp/help.txt && featherpad /tmp/help.txt
Was just wondering if there was a more efficient way to just open right into text editor without having to generate a txt file?

Thank you for any suggestions

User avatar
CharlesV
Administrator
Posts: 8030
Joined: Sun Jul 07, 2019 5:11 pm

Re: Open CL help,man, info, tldr in a graphical text editor

#2 Post by CharlesV »

Tossing the webpage to a webbrowser works well for me. (And then of course full searches are available.)

I primarily use firefox, but there is an issue with man and firefox, so I use brave for this one.
if you set up a script to do all of it it works nicely. ( make sure to make the permissions so you can run it.)

-- manlookup

Code: Select all

#!/bin/bash
 
empty=""
 
if [ $1 == $empty ] ; then
    echo 
    echo "Usage: manlookup topic"
    echo
    exit 1
else
  export BROWSER=brave-browser-stable

  man --html "$1"

fi 
so you would ask for a man page on netstat with

Code: Select all

manlookup netstat

( I did have to install groff too.)

There also is man2html but I found it added a bunch of stuff I didnt want on board.

And you could also redirect your man page out to a text file and then pick that up in a web browser. Like this:

Code: Select all

man -Thtml netstat > manpage.html
firefox manpage.html

*QSI = Quick System Info from menu (Copy for Forum)
*MXPI = MX Package Installer
*Please check the solved checkbox on the post that solved it.
*Linux -This is the way!

User avatar
Melber
Developer
Posts: 1438
Joined: Tue Mar 23, 2021 4:19 pm

Re: Open CL help,man, info, tldr in a graphical text editor

#3 Post by Melber »

@advice1010
Not exactly what you're looking for, but maybe try this yad script.

Save the following as a file and make executable.
If necessary, adjust MANHELP_PATH in the script to where you want to save the generated txt files.

Code: Select all

#!/bin/bash

MANHELP_PATH=$HOME/Dokumente/manhelp

TITLE=manhelp
CLASS=manhelp
ICONPATH="help-browser"

MAIN=$(yad --title=$TITLE --class=$CLASS --window-icon=$ICONPATH \
--form --columns=2 --width=300 --height=150 --borders=10 --mouse \
--field="Info Type":LBL "" \
--field="Bash Command":LBL "" \
--field="":CB "man!help" \
--field="":CE ""
)

#echo $MAIN

MAIN=$(echo "$MAIN" | sed -e 's/|/ /g')

#echo $MAIN

commandname=($MAIN)

what="${commandname[0]}"
command="${commandname[1]}"

if [ -z "$command" ]; then
    exit
fi
        
if [ "$what" = 'man' ]; then

    if [ ! -f $MANHELP_PATH/$command-man.txt ]; then
        man $command > $MANHELP_PATH/$command-man.txt
    fi
        
    fpad $MANHELP_PATH/$command-man.txt
        
elif [ "$what" = 'help' ]; then

    if [ ! -f $MANHELP_PATH/$command-help.txt ]; then
        $command --help > $MANHELP_PATH/$command-help.txt
    fi
    
    fpad $MANHELP_PATH/$command-help.txt

fi

exit


Run the script and this window opens

231016_manhelp.png

Chose man or help, enter command and OK.
txt file opens in featherpad.
(If selected info doesn't already exist, it gets written as a txt file in $MANHELP_PATH)
You do not have the required permissions to view the files attached to this post.

advice1010
Posts: 349
Joined: Tue Feb 21, 2023 3:50 pm

Re: Open CL help,man, info, tldr in a graphical text editor

#4 Post by advice1010 »

@CharlesV
@Melber
Hey guys, thank you so much for your responses.
Give me a little time to test these, and I will share my results.
I am still open to any other ideas as well if anyone has anything else to test out, while I am testing out the ones mentioned above.
These both look interesting.
Thanks again

Post Reply

Return to “Software / Configuration”