question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Man Page on Windows

See original GitHub issue

I’m contemplating whether it would be possible make the man page available in Windows.

This is not a complete solution, these are just my initial thoughts exploring what would be required and how we might go about doing it… Any thoughts, feedback or suggestions would be welcome…

Converting the man page to a readable format for the Windows console

Since Windows doesn’t have a manual reader, the man page would need to be converted to a format that can be rendered in the Windows console. This would have to be performed as part of the build process when there’s a new release.

One option would be to simply convert it to plain text output. This conversion can be achieved as follows:

MANWIDTH=80 man ./ssh-audit.1 > ssh_audit_windows_man.txt

In Windows 10, the console is capable of interpreting ANSI escape sequences (also known as VT escape sequences). So another option would be to convert the man page to ANSI escape sequence formatted output, this would preserve any typographical emphasis that’s present in the original man page, such as bold and underlined text. This conversion can be achieved as follows:

# * man outputs a backspace-overwrite sequence rather than an ANSI escape 
#   sequence.
# * 'MAN_KEEP_FORMATTING' preserves the backspace-overwrite sequence when 
#   redirected to a file or a pipe.
# * The 'ul' command converts the backspace-overwrite sequence to an ANSI escape 
#   sequence.

MANWIDTH=80 MAN_KEEP_FORMATTING=1 man ./ssh-audit.1 | ul > ssh_audit_windows_man.txt

Example of an ANSI escape sequence formatted man page on Windows 10

import os
os.system("color")

f = open('c:\\bitbucket\\ssh_audit_windows_man.txt', encoding="utf-8")
file_contents = f.read()
print (file_contents)
f.close()

man-page-on-windows

Displaying the man page

Displaying the man page could perhaps be invoked using a command line parameter such as:

ssh-audit.exe --manual

Packaging the converted man page

Currently the Windows package is a standalone executable with no external dependencies. Ideally any solution that’s adopted would preserve this.

Does anyone know of a way that the man page (in its converted format) could be embedded into the ssh-audit executable without having to ship an external text file?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:35 (34 by maintainers)

github_iconTop GitHub Comments

1reaction
jtestacommented, Feb 18, 2021

Merged. Thanks for helping me with this!

I’d like to get a release out the door soon. I’m just waiting on a block of hours to free up so I can focus on packaging everything up correctly. Hopefully that will be within the next few days!

Thanks again!

1reaction
jtestacommented, Feb 1, 2021

Do you want to continue building against Python 3.7.x or move to 3.9.x?

I’ll switch to Python 3.9 for Windows builds, then.

Should I open a new PR for this?

To update PACKAGING? That wouldn’t be necessary. I’ll update it myself with tweaks after each time I package a new release.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Where is the 'man' Program for Windows (Program to open ...
If you are looking to open linux style man pages in Windows, then get Groff for Windows to view the man pages on...
Read more >
What is the equivalent to --help or man page in Windows?
man doesn't really have an equivalent in the DOS and Windows NT world. The closest equivalent was help command, which in DR-DOS 5.0...
Read more >
[SOLVED] Windows equivalent to man pages?
I'm studying for the 70-680 and I was wondering if, for the command line tools, whether or not there's any analog to UNIX...
Read more >
man command in Windows possible (?) - Developer Monkey
I discovered a win32 implementation of mandoc here, which sounds interesting, but I decided not to explore it further than seeing if it'd...
Read more >
What is a Man Page?
Man Page is shorthand for manual page. UNIX and Linux based operating systems include a help manual to assist users with command line...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found