簡體   English   中英

打印出包括名稱說明的terminfo條目嗎?

[英]Print out a terminfo entry including capname descriptions?

打印出terminfo條目(例如,對於我當前的終端:xterm-256color)最直接的方法是什么,其中包括terminfo手冊頁中每個名稱的簡短描述?

我知道如何使用以下命令為我的終端打印出terminfo條目(每行一個名稱):

infocmp -1

產生:

#   Reconstructed via infocmp from file: /usr/share/terminfo/78/xterm-256color
xterm-256color|xterm with 256 colors,
    am,
    bce,
    ccc,
    km,
    mc5i

Etc.

而且我可以在terminfo手冊頁中手動查找每個名稱的描述(例如ccc表示“終端可以重新定義現有顏色”),但是有一種方法可以顯示每個名稱的描述,而不必手動查找每個名稱?

因此,例如,我希望看到這樣的內容:

xterm-256color|xterm with 256 colors
am         terminal has automatic margins
bce        screen erased with background color
ccc        terminal can redefine existing colors
km         Has a meta key (i.e., sets 8th bit)
mc5i       printer will not echo on screen

Etc.

infocmp的輸出始終是定界的,並且相對容易解析,但是在terminfo手冊頁上列出了終端功能(具有變化的列寬和跨越多行的capname描述)的表卻沒有。 如果是這樣,生成我描述的輸出將更加簡單。 也許存在terminfo手冊頁中內容的替代來源,該來源在編程上更易於操作?

我正在運行GNU bash版本4.4.23(1)-發行版(x86_64-apple-darwin18.0.0)。

可能不是。 實際上, 手冊頁和其他文件是使用數據文件中的 腳本構建的,但尚未安裝

由於生成了該信息,因此您可以編寫一個腳本來提取信息,盡管您發現將其作為bash腳本具有挑戰性(perl是,awk是,sed ...也許)。 這是一小部分文本(已安裝在您的系統上):

.TS H
center expand;
c l l c
c l l c
lw25 lw6 lw2 lw20.
\fBVariable     Cap-    TCap    Description\fR
\fBBooleans     name    Code\fR
auto_left_margin        bw      bw      T{
cub1 wraps from column 0 to last column
T}
auto_right_margin       am      am      T{
terminal has automatic margins
T}
back_color_erase        bce     ut      T{
screen erased with background color
T}
can_change      ccc     cc     

您始終可以使用infocmp列出名稱,如果順序與(默認) 名稱相同,則可以將它們組合在一起。 但是,長名稱列表按字母順序排序(布爾,數字和字符串組成的組,如短名稱),而短名稱默認情況下按順序排列,以匹配SVr4 terminfo數據。 您可能會看到以下內容:

xterm-256color|xterm with 256 colors
        am      auto_right_margin
        bce     back_color_erase
        ccc     backspaces_with_bs
        km      can_change
        mc5i    eat_newline_glitch
        mir     has_meta_key
        msgr    move_insert_mode
        npc     move_standout_mode
        xenl    no_pad_char
        colors  prtr_silent
        cols    columns 
        it      init_tabs 
        lines   lines
        pairs   max_colors
        acsc    max_pairs
        bel     acs_chars  
        blink   back_tab
        bold    bell

實際上,ncurses具有允許對名稱進行排序的選項,因此您可以(幾乎)使用-sl選項匹配右列的順序。 您可能會看到以下內容:

xterm-256color|xterm with 256 colors
        am      auto_right_margin
        bce     back_color_erase
        ccc     backspaces_with_bs
        xenl    can_change
        km      eat_newline_glitch
        mir     has_meta_key
        msgr    move_insert_mode
        npc     move_standout_mode
        mc5i    no_pad_char
        cols    prtr_silent
        it      columns
        lines   init_tabs
        colors  lines
        pairs   max_colors
        acsc    max_pairs
        cbt     acs_chars
        bel     back_tab
        cr      bell

幾乎“幾乎” ,因為列未將xenleat_newline_glitch因為ncurses具有backspaces_with_bs的內部名稱,通常不會顯示。 更改ncurses源以顯示:

xterm-256color|xterm with 256 colors
        am      auto_right_margin
        bce     back_color_erase
        OTbs    backspaces_with_bs
        ccc     can_change 
        xenl    eat_newline_glitch

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM