1#compdef lynx
2
3local curcontext="$curcontext" state line ret=1
4typeset -A opt_args
5
6_arguments -C \
7  '-accept_all_cookies[accept cookies without prompting if Set-Cookie handling is on (off)]' \
8  '-anonymous[apply restrictions for anonymous account, see also -restrictions]' \
9  "-assume_charset=[charset for documents that don't specify it]:character set:" \
10  '-assume_local_charset=[charset assumed for local files]:character set:' \
11  '-assume_unrec_charset=[use this instead of unrecognized charsets]:character set:' \
12  '-auth=[authentication information for protected documents]:username\:password:' \
13  '-base[prepend a request URL comment and BASE tag to text/html outputs for -source dumps]' \
14  '-bibp=[specify a local bibp server (default http://bibhost/)]:bibp server:_urls' \
15  '-blink[forces high intensity background colors for color mode, if available and supported by the terminal]' \
16  '-book[use the bookmark page as the startfile (off)]' \
17  '-buried_news[toggles scanning of news articles for buried references (on)]' \
18  '-cache=[specify number of documents cached in memory]:number of documents:' \
19  '-case[enable case sensitive user searching (off)]' \
20  '-center[toggle center alignment in HTML TABLE (off)]' \
21  '-cfg=[specifies a lynx.cfg file other than the default]:configuration file:_files' \
22  '-child[exit on left-arrow in startfile, and disable save to disk]' \
23  '-child_relaxed[exit on left-arrow in startfile (allows save to disk)]' \
24  '-cmd_log=[log keystroke commands to the given file]:keystroke log:_files' \
25  '-cmd_script=[read keystroke commands from the given file (see -cmd_log)]:keystroke log:_files' \
26  '-color[forces color mode on, if available]' \
27  '-collapse_br_tags[toggle collapsing of BR tags (on)]' \
28  '-connect_timeout=[set the N-second connection timeout]:connection timeout (seconds) [18000]' \
29  '-convert_to=[convert input]:format:_mime_types' \
30  '-cookie_file=[specifies a file to use to read cookies]:cookie file:_files' \
31  '-cookie_save_file=[specifies a file to use to store cookies]:cookie file:_files' \
32  '-cookies[toggles handling of Set-Cookie headers (on)]' \
33  '-core[toggles forced core dumps on fatal errors (off)]' \
34  '-crawl[with -traversal, output each page to a file with -dump, format output as with -traversal, but to stdout]' \
35  '-curses_pads[uses curses pad feature to support left/right shifting (on)]' \
36  '-debug_partial[incremental display stages with MessageSecs delay (off)]' \
37  '-default_colors[use terminal default foreground/background colors (on)]' \
38  '-delay=[set NNN-second delay at statusline message]:delay (seconds) [0.000]' \
39  "-display=[set the display variable for X exec'ed programs]:display:_x_display" \
40  '-display_charset=[charset for the terminal output]:character set:' \
41  "-dont_wrap_pre[inhibit wrapping of text in <pre> when -dump'ing and -crawl'ing, mark wrapped lines in interactive session (off)]" \
42  '-dump[dump the first file to stdout and exit]' \
43  '-editor=[enable edit mode with specified editor]:editor:_command_names -e' \
44  '-emacskeys[enable emacs-like key movement (off)]' \
45  "-enable_scrollback[toggles compatibility with comm programs' scrollback keys (may be incompatible with some curses packages) (off)]" \
46  '-error_file=[write the HTTP status code here]:error file:_files' \
47  '-exec[enable local program execution (normally not configured)]' \
48  '-fileversions[include all versions of files in local VMS directory listings]' \
49  '-force_empty_hrefless_a[force HREF-less 'A' elements to be empty (close them as soon as they are seen) (off)]' \
50  '-force_html[forces the first document to be interpreted as HTML (off)]' \
51  '-force_secure[toggle forcing of the secure flag for SSL cookies (off)]' \
52  '-forms_options[toggles forms-based vs old-style options menu (on)]' \
53  '-from[toggle transmission of From headers (on)]' \
54  '-ftp[disable ftp access (off)]' \
55  '-get_data[user data for get forms, read from stdin, terminated by '---' on a line]' \
56  '-head[send a HEAD request (off)]' \
57  '(- *)-help[print this usage message]' \
58  '-hiddenlinks=[hidden links: options are merge, listonly, or ignore]:option:(merge listonly ignore)' \
59  "-historical[toggles use of '>' or '-->' as terminator for comments (off)]" \
60  '-homepage=[set homepage separate from start page]:URL:->html' \
61  '-html5_charsets[toggle use of HTML5 charset replacements]' \
62  '-image_links[toggles inclusion of links for all images (off)]' \
63  '-index=[set the default index file to URL]:URL:->html' \
64  '-ismap[toggles inclusion of ISMAP links when client-side MAPs are present (off)]' \
65  '-justify[do justification of text (off)]' \
66  '-link=[starting count for lnk#.dat files produced by -crawl (0)]:starting count:' \
67  '-list_inline[with -dump, show links inline with text]' \
68  '-listonly[with -dump, forces it to show only the list of links (off)]' \
69  '-localhost[disable URLs that point to remote hosts (off)]' \
70  '-locexec[enable local program execution from local files only (if lynx was compiled with local execution enabled)]' \
71  '-lss=[specifies a lynx.lss file other than the default]:color-style file:_files' \
72  '-mime_header[include mime headers and force source dump]' \
73  '-minimal[toggles minimal versus valid comment parsing (on)]' \
74  '-newschunksize=[number of articles in chunked news listings]:number of news articles:' \
75  '-newsmaxchunk=[maximum news articles in listings before chunking]:maximum number of news articles:' \
76  '-nobold[disable bold video-attribute]' \
77  '-nobrowse[disable directory browsing]' \
78  '-nocc[disable Cc: prompts for self copies of mailings (off)]' \
79  '-nocolor[turn off color support]' \
80  '-noexec[disable local program execution]' \
81  '-nofilereferer[disable transmission of Referer headers for file URLs (on)]' \
82  '-nolist[disable the link list feature in dumps (off)]' \
83  '-nolog[disable mailing of error messages to document owners (on)]' \
84  '-nomargins[disable the right/left margins in the default style-sheet (off)]' \
85  '-nomore[disable -more- string in statusline messages]' \
86  '-nonrestarting_sigwinch[make window size change handler non-restarting (off)]' \
87  '-nonumbers[disable the link/form numbering feature in dumps (off)]' \
88  '-nopause[disable forced pauses for statusline messages]' \
89  '-noprint[disable some print functions, like -restrictions=print (off)]' \
90  "-noredir[don't follow Location: redirection (off)]" \
91  '-noreferer[disable transmission of Referer headers (off)]' \
92  '-noreverse[disable reverse video-attribute]' \
93  '-nosocks[disable SOCKS proxy usage by a SOCKSified Lynx]' \
94  '-nostatus[disable the miscellaneous information messages (off)]' \
95  '-notitle[disable the title at the top of each page (off)]' \
96  '-nounderline[disable underline video-attribute]' \
97  "-nozap=[disable checks for the 'z' key]:duration:(all initially full)" \
98  '-number_fields[force numbering of links as well as form input fields (off)]' \
99  '-number_links[force numbering of links (off)]' \
100  '-partial[toggles display partial pages while downloading (on)]' \
101  '-partial_thres=[number of lines to render before repainting display with partial-display logic (-1)]:number of lines:' \
102  '-passive-ftp[toggles passive ftp connection (on)]' \
103  '-pauth=[authentication information for protected proxy server]:username\:password:' \
104  '-popup[toggles handling of single-choice SELECT options via popup windows or as lists of radio buttons (off)]' \
105  '-post_data[user data for post forms, read from stdin, terminated by '---' on a line]' \
106  '-preparsed[show parsed text/html with -source and in source view to visualize how lynx behaves with invalid HTML (off)]' \
107  '-prettysrc[do syntax highlighting and hyperlink handling in source view (off)]' \
108  '-print[enable print functions (DEFAULT), opposite of -noprint (on)]' \
109  '-pseudo_inlines[toggles pseudo-ALTs for inlines with no ALT string (on)]' \
110  '-raw[toggles default setting of 8-bit character translations or CJK mode for the startup character set (off)]' \
111  '-realm[restricts access to URLs in the starting realm (off)]' \
112  '-read_timeout=[set the N-second read-timeout]:timeout (seconds) [18000]' \
113  '-reload[flushes the cache on a proxy server (only the first document affected) (off)]' \
114  '-restrictions=[use -restrictions to see list]:options:->restrictions' \
115  '-resubmit_posts[toggles forced resubmissions (no-cache) of forms with method POST when the documents they returned are sought with the PREV_DOC command or from the History List (off)]' \
116  '-rlogin[disable rlogins (off)]' \
117  '-scrollbar[toggles showing scrollbar (off)]' \
118  '-scrollbar_arrow[toggles showing arrows at ends of the scrollbar (on)]' \
119  '-selective[require .www_browsable files to browse directories]' \
120  '-session=[resume from specified file on startup and save session to it on exit]:session file:_files' \
121  '-sessionin=[resume session from specified file on startup]:session file:_files' \
122  '-sessionout=[save session to specified file on exit]:session file:_files' \
123  '-short_url[enables examination of beginning and end of long URL in status line (off)]' \
124  "-show_cfg[show 'LYNX.CFG' setting (off)]" \
125  '-show_cursor[toggles hiding of the cursor in the lower right corner (on)]' \
126  '-show_rate[toggles display of transfer rate (on)]' \
127  "-soft_dquotes[toggles emulation of the old Netscape and Mosaic bug which treated '>' as a co-terminator for double-quotes and tags (off)]" \
128  '-source[dump the source of the first file to stdout and exit]' \
129  '-stack_dump[disable SIGINT cleanup handler (off)]' \
130  '-startfile_ok[allow non-http startfile and homepage with -validate (off)]' \
131  '-stderr[write warning messages to standard error when -dump or -source is used (off)]' \
132  '-stdin[read startfile from standard input (off)]' \
133  '-tagsoup[use TagSoup rather than SortaSGML parser (off)]' \
134  '-telnet[disable telnets (off)]' \
135  '-term=[set terminal type]:terminal name:_terminals' \
136  '-tlog[toggles use of a Lynx Trace Log for the current session (on)]' \
137  '-tna[turn on "Textfields Need Activation" mode (off)]' \
138  '-trace[turns on Lynx trace mode (off)]' \
139  '-trace_mask=[customize Lynx trace mode]:trace mask:(0 1 2 3 4 5 6 7)' \
140  '-traversal[traverse all http links derived from startfile]' \
141  '-trim_blank_lines[toggle trimming of leading/trailing/collapsed-br blank lines (on)]' \
142  '-trim_input_fields[trim input text/textarea fields in forms (off)]' \
143  '-underline_links[toggles use of underline/bold attribute for links (off)]' \
144  '-underscore[toggles use of _underline_ format in dumps (off)]' \
145  '-unique_urls[toggle use of unique-urls setting for -dump and -listonly options (off)]' \
146  '-use_mouse[turn on mouse support (off)]' \
147  '-useragent=[set alternate Lynx User-Agent header]:user-agent header:' \
148  '-validate[accept only http URLs (meant for validation) implies more restrictions than -anonymous, but goto is allowed for http and https (off)]' \
149  '-verbose[toggles [LINK\], [IMAGE\] and [INLINE\] comments with filenames of these images (on)]' \
150  '(- *)-version[print Lynx version information]' \
151  '-vikeys[enable vi-like key movement (off)]' \
152  '-width=[specify screen width for formatting of dumps]:number of columns [80]' \
153  '-with_backspaces[emit backspaces in output if -dumping or -crawling]' \
154  '-xhtml-parsing[enable XHTML 1.0 parsing (off)]' \
155  ':URL:->html' && ret=0
156
157case "$state" in
158restrictions)
159  _values -s ',' 'restriction' \
160    \? all bookmark bookmark_exec change_exec_perms chdir compileopts_info \
161    default dired_support disk_save dotfiles download editor exec exec_frozen \
162    externals file_url goto inside_ftp inside_news inside_rlogin \
163    inside_telnet jump lynxcfg_info lynxcfg_xinfo lynxcgi mail multibook \
164    news_post options_save outside_ftp outside_news outside_rlogin \
165    outside_telnet print shell suspend telnet_port useragent && return
166  ;;
167html)
168  _alternative 'files:file:_files -g "*.x#html#(-.)"' 'urls:URL:_urls' && return
169  ;;
170esac
171
172return ret
173