.
This commit is contained in:
parent
c4dcb6e38b
commit
531029a18f
129 changed files with 7765 additions and 6938 deletions
|
|
@ -1,33 +1,40 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en"><head>
|
||||
<!doctype html>
|
||||
<html lang="en"><head><script src="/livereload.js?mindelay=10&v=2&port=1313&path=livereload" data-no-instant defer></script>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<link rel="shortcut icon" href="https://nonsense.dymc.win/favicon.ico">
|
||||
|
||||
<link rel="stylesheet" href="/css/style.min.css">
|
||||
<link rel="shortcut icon" href="http://localhost:1313/favicon.ico">
|
||||
<link id="stylesheet" rel="stylesheet" href="/css/light.css">
|
||||
|
||||
<link rel="canonical" href="https://nonsense.dymc.win/teeny-tiny-bash-fetch-script/" />
|
||||
<title>teeny tiny bash fetch script</title>
|
||||
<link rel="canonical" href="http://localhost:1313/teeny-tiny-bash-fetch-script/" />
|
||||
<title>Teeny tiny bash fetch script</title>
|
||||
</head>
|
||||
<body><header id="banner">
|
||||
<h2><a href="https://nonsense.dymc.win/">James' Blog :-)</a></h2>
|
||||
<nav>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="/info/" title="--help">--help</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<nav class="navbar">
|
||||
<div class="nav-left">
|
||||
|
||||
<a href="http://localhost:1313/" class="home">~ 🏠</a>
|
||||
|
||||
<a
|
||||
href="/info/"
|
||||
title="--help"
|
||||
>--help</a
|
||||
>
|
||||
</div>
|
||||
<div class="nav-right">
|
||||
|
||||
<button id="toggle-button" class="toggle-button" onclick="toggleTheme()">🌚</button>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<main id="content">
|
||||
<article>
|
||||
<header id="post-header">
|
||||
<h1>teeny tiny bash fetch script</h1>
|
||||
<div>
|
||||
<time>December 10, 2022</time>
|
||||
</div>
|
||||
</header><p>This is my attempt at a neofetch, pfetch, whateverfetch style system info utility. My main concern was making something which looked nice, was easily configurable, and as portable as possible (I didn’t really try that hard with the portability). I didn’t think much about performance; I’m personally not a man who stresses too much when a command takes a quarter of a second instead of a tenth. The basic gameplan was to get an array of bash commands which would fetch various bits and bobs, then loop through this array formatting the text with ANSI escape codes. First things first, this was the associative array I came up with:</p>
|
||||
<header id="post-header">
|
||||
<h3>Teeny tiny bash fetch script</h3>
|
||||
<div>
|
||||
<time>December 10, 2022</time>
|
||||
</div>
|
||||
</header><p>This is my attempt at a neofetch, pfetch, whateverfetch style system info utility. My main concern was making something which looked nice, was easily configurable, and as portable as possible (I didn’t really try that hard with the portability). I didn’t think much about performance; I’m personally not a man who stresses too much when a command takes a quarter of a second instead of a tenth. The basic gameplan was to get an array of bash commands which would fetch various bits and bobs, then loop through this array formatting the text with ANSI escape codes. First things first, this was the associative array I came up with:</p>
|
||||
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nb">declare</span> -A <span class="nv">fetch</span><span class="o">=(</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="o">[</span>user<span class="o">]=</span><span class="s2">"</span><span class="nv">$USER</span><span class="s2">"</span>
|
||||
</span></span><span class="line"><span class="cl"> <span class="o">[</span>host<span class="o">]=</span><span class="s2">"</span><span class="k">$(</span>cat /etc/hostname<span class="k">)</span><span class="s2">"</span>
|
||||
|
|
@ -97,9 +104,18 @@
|
|||
</span></span></code></pre></div><p>This had the happy unintended consequence of allowing you to very easily configure which items you wanted in the fetch by simply commenting out keys from the order array. You can check out the script in its entirety <a href="https://gitlab.com/robbygozzarder/golazo">here</a>. This is a pretty picture of a few variations.</p>
|
||||
<p><img src="/image/golazo.png" alt="golazo"></p>
|
||||
</article>
|
||||
|
||||
</main><footer id="footer">
|
||||
<p>made with <a href="https://gohugo.io">hugo</a> and my bastardised version of <a href="https://github.com/LukasJoswiak/etch">this nice theme</a></p>
|
||||
</main>
|
||||
|
||||
<footer id="footer">
|
||||
<p>-----------------</p>
|
||||
<small>
|
||||
made with <a href="https://gohugo.io">hugo</a> and my bastardised version of
|
||||
<a href="https://github.com/LukasJoswiak/etch">this nice theme</a>
|
||||
</small>
|
||||
|
||||
<script src="/js/search.js"></script>
|
||||
<script src="/js/toggle.js"></script>
|
||||
</footer>
|
||||
</body>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue