Skip to content

[FEATURE] Added -man parameter to generate manual page for ccextractor using help2man#878

Closed
mahalwal wants to merge 5 commits intoCCExtractor:masterfrom
mahalwal:master
Closed

[FEATURE] Added -man parameter to generate manual page for ccextractor using help2man#878
mahalwal wants to merge 5 commits intoCCExtractor:masterfrom
mahalwal:master

Conversation

@mahalwal
Copy link
Copy Markdown
Contributor

@mahalwal mahalwal commented Jan 5, 2018

Please prefix your pull request with one of the following: [FEATURE] [FIX] [IMPROVEMENT].

In raising this pull request, I confirm the following (please check boxes):

  • I have read and understood the contributors guide.
  • I have checked that another pull request for this purpose does not exist.
  • I have considered, and confirmed that this submission will be valuable to others.
  • I accept that this submission may not be used, and the pull request closed at the will of the maintainer.
  • I give this submission freely, and claim no ownership to its content.

My familiarity with the project is as follows (check one):

  • I have never used CCExtractor.
  • I have used CCExtractor just a couple of times.
  • I absolutely love CCExtractor, but have not contributed previously.
  • I am an active contributor to CCExtractor.

I have added the -man parameter which generates the man page using help2man (dependency).
help2man uses the output from --help and --version of CCExtractor's executable.
This pull request supports man pages only for Linux users. I will add support for mac as well as other users after someone provides their feedback on this pull.

Comment thread src/lib_ccx/params.c
}
if (strcmp (argv[i], "-")==0 || strcmp(argv[i], "-stdin") == 0)
{
#ifdef WIN32
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minimum two spaces were required after every parameter so that help2man is able to detect different options.

Comment thread src/lib_ccx/params.c
mprint("Finished executing man script\n");
#endif
return EXIT_WITH_HELP;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a really really weird solution - if ccextractor (the binary) cannot generate the man page directly, then the correct way to generate it would be for manscript.sh to call ccextractor -help to get the output, and then do the transformation from the script, generate the man page, and possibly install it (if a install parameter is present).

Otherwise you're forcing the user to have manscript.sh around. Where would be this file be? ccextractor usually goes in /usr/local/bin or /usr/bin, but a file called manscript.sh doesn't really go there...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with this. It seems a weird solution, and it makes quite a lot of assumptions.

Comment thread src/lib_ccx/params.c
mprint (" -fixptsjumps: fix pts jumps. Use this parameter if you\n");
mprint (" experience timeline resets/jumps in the output.\n");
mprint (" -stdin: Reads input from stdin (console) instead of file.\n");
mprint (" inputfile: file(s) to process\n");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why all those extra spaces in the help? Are they needed for the man?
Did you check that every line is still below 80 chars?

Copy link
Copy Markdown
Contributor Author

@mahalwal mahalwal Jan 6, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Atleast 2 spaces are required after every param for help2man to differentiate b/w the parameter and the the description.

Comment thread linux/manscript.sh

exechelp2man="help2man --section 7 --include=replace.h2m ./ccextractor > ccextractor.7"
echo $exechelp2man
eval $exechelp2man
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you using eval? There are most likely nicer ways available than this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll changes this

Comment thread linux/manscript.sh
eval $exechelp2man

mkdir -p /usr/local/man/man7
sudo cp ccextractor.7 /usr/local/man/man7/
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assuming a user has sudo available doesn't seem to wise. It'd be better to request the script to be executed with sudo or as root instead, and have a check for it.

Comment thread src/lib_ccx/activity.c
mprint ("CCExtractor %s, Carlos Fernandez Sanz, Volker Quetschke.\n", VERSION);
mprint ("Teletext portions taken from Petr Kutalek's telxcc\n");
mprint ("--------------------------------------------------------------------------\n");
// mprint ("--------------------------------------------------------------------------\n");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this line commented out?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For proper formatting in the man pages. This was not looking good

@mahalwal
Copy link
Copy Markdown
Contributor Author

mahalwal commented Jan 6, 2018

I am closing this PR and I'll send another one with the requested changes.
Since, currently help2man requires the binary, the workaround will be to use it with make which will only use the output from source file and not the binary.
Also the help2man website says this

This usage allows a manual page to be generated by the maintainer and included in the distribution without requiring the end-user to have help2man installed.

So is there a way we can update the roff file generated by help2man everytime someone updates the output from --help or --version?
@canihavesomecoffee @cfsmp3

@mahalwal mahalwal closed this Jan 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants