2

I'm currently developing a set of shell functions and I want to document its output.

I remember there's a command that generates a basic outline in html (and markdown?) where on the first column you've got the command and it output on the right. A crude example:

ls -a1  | .
        | ..
        | a_dir/
        | a_file
        | another file
        |
ps      |   PID TTY          TIME CMD
        | 2920 pts/2    00:00:00 bash
        | 3015 pts/2    00:00:00 ps

I would like to know a program that given a set of commands will generate something similar to the previous example, wether it is html, markdown or anything similar.

4

1 回答 1

2

一种方法是使用该script实用程序

SCRIPT(1)                        User Commands                       SCRIPT(1)

NAME
     script — make typescript of terminal session

SYNOPSIS
     script [-a] [-c command] [-e] [-f] [-q] [-t[=file]] [-V] [-h] [file]

DESCRIPTION
     script makes a typescript of everything printed on your terminal.  It is
     useful for students who need a hardcopy record of an interactive session
     as proof of an assignment, as the typescript file can be printed out
     later with lpr(1).

还有一个可用的 python 实用程序,称为shelllogger

ShellLogger 捕获所有用户与 shell 的交互。它旨在供有兴趣从可以在编程会话期间自动捕获的数据中推断程序员行为的软件工程研究人员使用。它类似于 Unix 的“脚本”程序,但提供了额外的功能,例如 XML 输出、区分用户输入和系统输出以及跟踪用户的当前目录。

https://code.google.com/p/shelllogger/

于 2014-02-03T20:20:07.870 回答