1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

Merge pull request #252 from anandsudhir/make-openfileutil-configurable

Make openFileUtil configurable
This commit is contained in:
Chris Cummer 2018-07-24 12:58:13 -04:00 committed by GitHub
commit 7339003b9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 3 deletions

View File

@ -24,6 +24,7 @@ wtf:
# that support ten line of text, one of three lines, and one of four # that support ten line of text, one of three lines, and one of four
rows: [10, 10, 10, 10, 10, 3, 4] rows: [10, 10, 10, 10, 10, 3, 4]
# The app redraws itself once a second # The app redraws itself once a second
openFileUtil: open
refreshInterval: 1 refreshInterval: 1
term: "xterm-256color" term: "xterm-256color"
``` ```
@ -65,6 +66,9 @@ An array that defines the heights of all the rows. <br />
Values: See <a href="https://github.com/rivo/tview/wiki/Grid">tview's Values: See <a href="https://github.com/rivo/tview/wiki/Grid">tview's
Grid</a> for details. Grid</a> for details.
`openFileUtil` <br />
Command to use to open a file or URL
`refreshInterval` <br /> `refreshInterval` <br />
How often, in seconds, the UI refreshes itself. <br /> How often, in seconds, the UI refreshes itself. <br />
**Note:** This implementation is probably wrong and buggy and likely to **Note:** This implementation is probably wrong and buggy and likely to

View File

@ -299,7 +299,7 @@ cmd The terminal command to be run, withouth the arguments. Ie: ping, whoami, cu
<guid>https://wtfutil.com/posts/configuration/attributes/</guid> <guid>https://wtfutil.com/posts/configuration/attributes/</guid>
<description>The following top-level attributes are configurable in config.yml. See this example config file for more details. <description>The following top-level attributes are configurable in config.yml. See this example config file for more details.
wtf:colors:background:&amp;#34;red&amp;#34;border:Focusable:&amp;#34;darkslateblue&amp;#34;focused:&amp;#34;orange&amp;#34;normal:&amp;#34;gray&amp;#34;grid:# How _wide_ the columns are, in terminal characters. In this case we have# six columns, each of which are 35 characters widecolumns:[35,35,35,35,35,35]# How _high_ the rows are, in terminal lines. In this case we have five rows# that support ten line of text, one of three lines, and one of fourrows:[10,10,10,10,10,3,4]# The app redraws itself once a secondrefreshInterval:1term:&amp;#34;xterm-256color&amp;#34; Attributes colors.</description> wtf:colors:background:&amp;#34;red&amp;#34;border:Focusable:&amp;#34;darkslateblue&amp;#34;focused:&amp;#34;orange&amp;#34;normal:&amp;#34;gray&amp;#34;grid:# How _wide_ the columns are, in terminal characters. In this case we have# six columns, each of which are 35 characters widecolumns:[35,35,35,35,35,35]# How _high_ the rows are, in terminal lines. In this case we have five rows# that support ten line of text, one of three lines, and one of fourrows:[10,10,10,10,10,3,4]# The app redraws itself once a secondopenFileUtil:openrefreshInterval:1term:&amp;#34;xterm-256color&amp;#34; Attributes colors.</description>
</item> </item>
<item> <item>

View File

@ -154,6 +154,7 @@ See this <a href="https://github.com/senorprogrammer/wtf/blob/master/_sample_con
</span><span class="w"> </span><span class="c"># that support ten line of text, one of three lines, and one of four</span><span class="w"> </span><span class="w"> </span><span class="c"># that support ten line of text, one of three lines, and one of four</span><span class="w">
</span><span class="w"> </span>rows<span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="m">10</span><span class="p">,</span><span class="w"> </span><span class="m">10</span><span class="p">,</span><span class="w"> </span><span class="m">10</span><span class="p">,</span><span class="w"> </span><span class="m">10</span><span class="p">,</span><span class="w"> </span><span class="m">10</span><span class="p">,</span><span class="w"> </span><span class="m">3</span><span class="p">,</span><span class="w"> </span><span class="m">4</span><span class="p">]</span><span class="w"> </span><span class="w"> </span>rows<span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="m">10</span><span class="p">,</span><span class="w"> </span><span class="m">10</span><span class="p">,</span><span class="w"> </span><span class="m">10</span><span class="p">,</span><span class="w"> </span><span class="m">10</span><span class="p">,</span><span class="w"> </span><span class="m">10</span><span class="p">,</span><span class="w"> </span><span class="m">3</span><span class="p">,</span><span class="w"> </span><span class="m">4</span><span class="p">]</span><span class="w">
</span><span class="w"> </span><span class="c"># The app redraws itself once a second</span><span class="w"> </span><span class="w"> </span><span class="c"># The app redraws itself once a second</span><span class="w">
</span><span class="w"> </span>openFileUtil<span class="p">:</span><span class="w"> </span>open<span class="w">
</span><span class="w"> </span>refreshInterval<span class="p">:</span><span class="w"> </span><span class="m">1</span><span class="w"> </span><span class="w"> </span>refreshInterval<span class="p">:</span><span class="w"> </span><span class="m">1</span><span class="w">
</span><span class="w"> </span>term<span class="p">:</span><span class="w"> </span><span class="s2">&#34;xterm-256color&#34;</span></code></pre></div> </span><span class="w"> </span>term<span class="p">:</span><span class="w"> </span><span class="s2">&#34;xterm-256color&#34;</span></code></pre></div>
<h3 id="attributes">Attributes</h3> <h3 id="attributes">Attributes</h3>
@ -193,6 +194,9 @@ An array that defines the heights of all the rows. <br />
Values: See <a href="https://github.com/rivo/tview/wiki/Grid">tview&rsquo;s Values: See <a href="https://github.com/rivo/tview/wiki/Grid">tview&rsquo;s
Grid</a> for details.</p> Grid</a> for details.</p>
<p><code>openFileUtil</code> <br />
Command to use to open a file or URL</p>
<p><code>refreshInterval</code> <br /> <p><code>refreshInterval</code> <br />
How often, in seconds, the UI refreshes itself. <br /> How often, in seconds, the UI refreshes itself. <br />
<strong>Note:</strong> This implementation is probably wrong and buggy and likely to <strong>Note:</strong> This implementation is probably wrong and buggy and likely to

View File

@ -299,7 +299,7 @@ cmd The terminal command to be run, withouth the arguments. Ie: ping, whoami, cu
<guid>https://wtfutil.com/posts/configuration/attributes/</guid> <guid>https://wtfutil.com/posts/configuration/attributes/</guid>
<description>The following top-level attributes are configurable in config.yml. See this example config file for more details. <description>The following top-level attributes are configurable in config.yml. See this example config file for more details.
wtf:colors:background:&amp;#34;red&amp;#34;border:Focusable:&amp;#34;darkslateblue&amp;#34;focused:&amp;#34;orange&amp;#34;normal:&amp;#34;gray&amp;#34;grid:# How _wide_ the columns are, in terminal characters. In this case we have# six columns, each of which are 35 characters widecolumns:[35,35,35,35,35,35]# How _high_ the rows are, in terminal lines. In this case we have five rows# that support ten line of text, one of three lines, and one of fourrows:[10,10,10,10,10,3,4]# The app redraws itself once a secondrefreshInterval:1term:&amp;#34;xterm-256color&amp;#34; Attributes colors.</description> wtf:colors:background:&amp;#34;red&amp;#34;border:Focusable:&amp;#34;darkslateblue&amp;#34;focused:&amp;#34;orange&amp;#34;normal:&amp;#34;gray&amp;#34;grid:# How _wide_ the columns are, in terminal characters. In this case we have# six columns, each of which are 35 characters widecolumns:[35,35,35,35,35,35]# How _high_ the rows are, in terminal lines. In this case we have five rows# that support ten line of text, one of three lines, and one of fourrows:[10,10,10,10,10,3,4]# The app redraws itself once a secondopenFileUtil:openrefreshInterval:1term:&amp;#34;xterm-256color&amp;#34; Attributes colors.</description>
</item> </item>
<item> <item>

View File

@ -81,7 +81,8 @@ func NamesFromEmails(emails []string) []string {
// OpenFile opens the file defined in `path` via the operating system // OpenFile opens the file defined in `path` via the operating system
func OpenFile(path string) { func OpenFile(path string) {
filePath, _ := ExpandHomeDir(path) filePath, _ := ExpandHomeDir(path)
cmd := exec.Command("open", filePath) openFileUtil := Config.UString("wtf.openFileUtil", "open")
cmd := exec.Command(openFileUtil, filePath)
ExecuteCommand(cmd) ExecuteCommand(cmd)
} }