<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[cliui命令行工具 - 模具行业软件开发参考——模具行业从业者必备知识手册]]></title><description><![CDATA[<p dir="auto">&lt;h2&gt;cliui&lt;/h2&gt;</p>
<p dir="auto">&lt;p&gt;!&lt;a href="upload://cKQ68nDVtRFf8SzbSFWsrlA99IO.svg"&gt;cliui命令行工具 - 模具行业软件开发参考&lt;/a&gt;&lt;/p&gt;<br />
&lt;p&gt;&lt;a href="upload://sqAcau9485c9sUQUtGlsn5HxPiO.svg"&gt;&lt;img src="<a href="https://www.npmjs.com/package/cliui" rel="nofollow ugc">https://www.npmjs.com/package/cliui</a>" alt="NPM version&lt;/a&gt;"&gt;&lt;/p&gt;<br />
&lt;p&gt;&lt;a href="upload://Vr7nfdL10iISSygdp04NZo87Wx.svg"&gt;&lt;img src="<a href="https://conventionalcommits.org" rel="nofollow ugc">https://conventionalcommits.org</a>" alt="Conventional Commits&lt;/a&gt;"&gt;&lt;/p&gt;<br />
&lt;p&gt;!&lt;a href="upload://9dbJJzFss7MHNlBoCCNmLDGGETp.svg"&gt;nycrc config on GitHub&lt;/a&gt;&lt;/p&gt;</p>
<p dir="auto">&lt;p&gt;easily create complex multi-column command-line-interfaces.&lt;/p&gt;</p>
<p dir="auto">&lt;h3&gt;Example&lt;/h3&gt;</p>
<p dir="auto">&lt;pre&gt;&lt;code&gt;<br />
const ui = require('cliui')()</p>
<p dir="auto">ui.div('Usage: $0 [command] [options]')</p>
<p dir="auto">ui.div({<br />
text: 'Options:',<br />
padding: [2, 0, 1, 0]<br />
})</p>
<p dir="auto">ui.div(<br />
{<br />
text: "-f, --file",<br />
width: 20,<br />
padding: [0, 4, 0, 4]<br />
},<br />
{<br />
text: "the file to load." +<br />
chalk.green("(if this description is long it wraps).")<br />
,<br />
width: 20<br />
},<br />
{<br />
text: chalk.red("[required]"),<br />
align: 'right'<br />
}<br />
)</p>
<p dir="auto">console.log(ui.toString())<br />
&lt;/code&gt;&lt;/pre&gt;</p>
<p dir="auto">&lt;h3&gt;Deno/ESM Support&lt;/h3&gt;</p>
<p dir="auto">&lt;p&gt;As of &lt;code&gt;v7&lt;/code&gt; &lt;code&gt;cliui&lt;/code&gt; supports &lt;a href="<a href="https://github.com/denoland/deno" rel="nofollow ugc">https://github.com/denoland/deno</a>"&gt;Deno&lt;/a&gt; and&lt;/p&gt;<br />
&lt;p&gt;&lt;a href="<a href="https://nodejs.org/api/esm.html#esm_ecmascript_modules" rel="nofollow ugc">https://nodejs.org/api/esm.html#esm_ecmascript_modules</a>"&gt;ESM&lt;/a&gt;:&lt;/p&gt;</p>
<p dir="auto">&lt;pre&gt;&lt;code&gt;<br />
import cliui from "<a href="https://deno.land/x/cliui/deno.ts" rel="nofollow ugc">https://deno.land/x/cliui/deno.ts</a>";</p>
<p dir="auto">const ui = cliui({})</p>
<p dir="auto">ui.div('Usage: $0 [command] [options]')</p>
<p dir="auto">ui.div({<br />
text: 'Options:',<br />
padding: [2, 0, 1, 0]<br />
})</p>
<p dir="auto">ui.div({<br />
text: "-f, --file",<br />
width: 20,<br />
padding: [0, 4, 0, 4]<br />
})</p>
<p dir="auto">console.log(ui.toString())<br />
&lt;/code&gt;&lt;/pre&gt;</p>
<p dir="auto">&lt;p&gt;&lt;img width="500" src="screenshot.png"&gt;&lt;/p&gt;</p>
<p dir="auto">&lt;h3&gt;Layout DSL&lt;/h3&gt;</p>
<p dir="auto">&lt;p&gt;cliui exposes a simple layout DSL:&lt;/p&gt;</p>
<p dir="auto">&lt;p&gt;If you create a single &lt;code&gt;ui.div&lt;/code&gt;, passing a string rather than an&lt;/p&gt;<br />
&lt;p&gt;object:&lt;/p&gt;</p>
<p dir="auto">&lt;ul&gt;<br />
&lt;li&gt;&lt;code&gt;\n&lt;/code&gt;: characters will be interpreted as new rows.&lt;/li&gt;<br />
&lt;li&gt;&lt;code&gt;\t&lt;/code&gt;: characters will be interpreted as new columns.&lt;/li&gt;<br />
&lt;li&gt;&lt;code&gt;\s&lt;/code&gt;: characters will be interpreted as padding.&lt;/li&gt;<br />
&lt;/ul&gt;</p>
<p dir="auto">&lt;p&gt;&lt;strong&gt;as an example...&lt;/strong&gt;&lt;/p&gt;</p>
<p dir="auto">&lt;pre&gt;&lt;code&gt;<br />
var ui = require('./')({<br />
width: 60<br />
})</p>
<p dir="auto">ui.div(<br />
'Usage: node ./bin/foo.js\n' +<br />
'  &lt;regex&gt;\t  provide a regex\n' +<br />
'  &lt;glob&gt;\t  provide a glob\t [required]'<br />
)</p>
<p dir="auto">console.log(ui.toString())<br />
&lt;/code&gt;&lt;/pre&gt;</p>
<p dir="auto">&lt;p&gt;&lt;strong&gt;will output:&lt;/strong&gt;&lt;/p&gt;</p>
<p dir="auto">&lt;pre&gt;&lt;code&gt;<br />
Usage: node ./bin/foo.js<br />
&lt;regex&gt;  provide a regex<br />
&lt;glob&gt;   provide a glob          [required]<br />
&lt;/code&gt;&lt;/pre&gt;</p>
<p dir="auto">&lt;h3&gt;Methods&lt;/h3&gt;</p>
<p dir="auto">&lt;pre&gt;&lt;code&gt;<br />
cliui = require('cliui')<br />
&lt;/code&gt;&lt;/pre&gt;</p>
<p dir="auto">&lt;h4&gt;cliui({width: integer})&lt;/h4&gt;</p>
<p dir="auto">&lt;p&gt;Specify the maximum width of the UI being generated.&lt;/p&gt;<br />
&lt;p&gt;If no width is provided, cliui will try to get the current window's width and use it, and if that doesn't work, width will be set to &lt;code&gt;80&lt;/code&gt;.&lt;/p&gt;</p>
<p dir="auto">&lt;h4&gt;cliui({wrap: boolean})&lt;/h4&gt;</p>
<p dir="auto">&lt;p&gt;Enable or disable the wrapping of text in a column.&lt;/p&gt;</p>
<p dir="auto">&lt;h4&gt;cliui.div(column, column, column)&lt;/h4&gt;</p>
<p dir="auto">&lt;p&gt;Create a row with any number of columns, a column&lt;/p&gt;<br />
&lt;p&gt;can either be a string, or an object with the following&lt;/p&gt;<br />
&lt;p&gt;options:&lt;/p&gt;</p>
<p dir="auto">&lt;ul&gt;<br />
&lt;li&gt;&lt;strong&gt;text:&lt;/strong&gt; some text to place in the column.&lt;/li&gt;<br />
&lt;li&gt;&lt;strong&gt;width:&lt;/strong&gt; the width of a column.&lt;/li&gt;<br />
&lt;li&gt;&lt;strong&gt;align:&lt;/strong&gt; alignment, &lt;code&gt;right&lt;/code&gt; or &lt;code&gt;center&lt;/code&gt;.&lt;/li&gt;<br />
&lt;li&gt;&lt;strong&gt;padding:&lt;/strong&gt; &lt;code&gt;[top, right, bottom, left]&lt;/code&gt;.&lt;/li&gt;<br />
&lt;li&gt;&lt;strong&gt;border:&lt;/strong&gt; should a border be placed around the div?&lt;/li&gt;<br />
&lt;/ul&gt;</p>
<p dir="auto">&lt;h4&gt;cliui.span(column, column, column)&lt;/h4&gt;</p>
<p dir="auto">&lt;p&gt;Similar to &lt;code&gt;div&lt;/code&gt;, except the next row will be appended without&lt;/p&gt;<br />
&lt;p&gt;a new line being created.&lt;/p&gt;</p>
<p dir="auto">&lt;h4&gt;cliui.resetOutput()&lt;/h4&gt;</p>
<p dir="auto">&lt;p&gt;Resets the UI elements of the current cliui instance, maintaining the values&lt;/p&gt;<br />
&lt;p&gt;set for &lt;code&gt;width&lt;/code&gt; and &lt;code&gt;wrap&lt;/code&gt;.&lt;/p&gt;</p>
<p dir="auto">&lt;hr&gt;</p>
<p dir="auto">&lt;p&gt;本文由模极社发布&lt;/p&gt;</p>
<p dir="auto">&lt;hr&gt;<br />
&lt;h4&gt;<img src="https://forum.mj7.cn/assets/plugins/nodebb-plugin-emoji/emoji/android/1f4cb.png?v=k0o2a4s5i30" class="not-responsive emoji emoji-android emoji--clipboard" title=":clipboard:" alt="📋" /> 相关标准参考&lt;/h4&gt;<br />
&lt;ul&gt;<br />
&lt;li&gt;GB/T 12555 塑料注射模模架&lt;/li&gt;<br />
&lt;/ul&gt;</p>
<p dir="auto">&lt;hr&gt;<br />
&lt;h4&gt;<img src="https://forum.mj7.cn/assets/plugins/nodebb-plugin-emoji/emoji/android/1f517.png?v=k0o2a4s5i30" class="not-responsive emoji emoji-android emoji--link" title=":link:" alt="🔗" /> 你可能还感兴趣&lt;/h4&gt;<br />
&lt;ul&gt;<br />
&lt;li&gt;&lt;a href="/t/3869/3869"&gt;手动发布63篇内容操作步骤&lt;/a&gt;&lt;/li&gt;<br />
&lt;li&gt;&lt;a href="/t/4382/4382"&gt;unimport&lt;/a&gt;&lt;/li&gt;<br />
&lt;li&gt;&lt;a href="/t/4278/4278"&gt;Security Policies and Procedures&lt;/a&gt;&lt;/li&gt;<br />
&lt;/ul&gt;</p>
<p dir="auto">&lt;hr&gt;<br />
&lt;p&gt;&lt;strong&gt;相关推荐：&lt;/strong&gt;&lt;/p&gt;<br />
&lt;ul&gt;<br />
&lt;li&gt;&lt;a href="<a href="https://www.mj7.cn/t/4836-4836" rel="nofollow ugc">https://www.mj7.cn/t/4836-4836</a>"&gt;北京模具产业 — 科技研发驱动型模具基地&lt;/a&gt;&lt;/li&gt;<br />
&lt;li&gt;&lt;a href="<a href="https://www.mj7.cn/t/4835-4835" rel="nofollow ugc">https://www.mj7.cn/t/4835-4835</a>"&gt;上海模具产业 — 高端精密模具研发中心&lt;/a&gt;&lt;/li&gt;<br />
&lt;li&gt;&lt;a href="<a href="https://www.mj7.cn/t/4834-4834" rel="nofollow ugc">https://www.mj7.cn/t/4834-4834</a>"&gt;产业集群与模具产业发展的关系&lt;/a&gt;&lt;/li&gt;<br />
&lt;/ul&gt;</p>
<p dir="auto">&lt;hr&gt;<br />
&lt;p&gt;各位师傅觉得这个方案怎么样？有更好的做法吗？&lt;/p&gt;</p>
]]></description><link>https://forum.mj7.cn/topic/7188/cliui命令行工具-模具行业软件开发参考-模具行业从业者必备知识手册</link><generator>RSS for Node</generator><lastBuildDate>Fri, 02 Oct 2026 11:05:13 GMT</lastBuildDate><atom:link href="https://forum.mj7.cn/topic/7188.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 19 Apr 2026 21:49:36 GMT</pubDate><ttl>60</ttl></channel></rss>