The source content for blog.juliobiason.me
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

115 lines
4.2 KiB

<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<!-- Enable responsiveness on mobile devices-->
<!-- viewport-fit=cover is to support iPhone X rounded corners and notch in landscape-->
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, viewport-fit=cover">
<title>Julio Biason .Me 4.3</title>
<!-- CSS -->
<link rel="stylesheet" href="https://blog.juliobiason.me/print.css" media="print">
<link rel="stylesheet" href="https://blog.juliobiason.me/poole.css">
<link rel="stylesheet" href="https://blog.juliobiason.me/hyde.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=PT+Sans:400,400italic,700|Abril+Fatface">
</head>
<body class=" ">
<div class="sidebar">
<div class="container sidebar-sticky">
<div class="sidebar-about">
<a href="https:&#x2F;&#x2F;blog.juliobiason.me"><h1>Julio Biason .Me 4.3</h1></a>
<p class="lead">Old school dev living in a 2.0 dev world</p>
</div>
<ul class="sidebar-nav">
<li class="sidebar-nav-item"><a href="&#x2F;">English</a></li>
<li class="sidebar-nav-item"><a href="&#x2F;pt">Português</a></li>
<li class="sidebar-nav-item"><a href="&#x2F;tags">Tags (EN)</a></li>
<li class="sidebar-nav-item"><a href="&#x2F;pt&#x2F;tags">Tags (PT)</a></li>
</ul>
</div>
</div>
<div class="content container">
<div class="post">
<h1 class="post-title">Things I Learnt The Hard Way - Command Line Options Are Weird, But Helpful</h1>
<span class="post-date">
2019-07-15
<a href="https://blog.juliobiason.me/tags/books/">#books</a>
<a href="https://blog.juliobiason.me/tags/things-i-learnt/">#things i learnt</a>
<a href="https://blog.juliobiason.me/tags/configuration/">#configuration</a>
<a href="https://blog.juliobiason.me/tags/command-line-options/">#command line options</a>
<a href="https://blog.juliobiason.me/tags/cli/">#cli</a>
</span>
<p>In this day and age, when everything has a graphical interface, does it still
makes sense to add command line options to your application? In fact, it does.</p>
<span id="continue-reading"></span>
<p>When I mentioned the configuration file, you may have thought about using
adding a default path for it and using the same file over and over.</p>
<p>Well, that's not wrong, but what if you want to use a different configuration?
Would you keep moving the original configuration file to another place, moving
your configuration back and keep this back and forth? Keep both versions and
just use a <a href="https://en.wikipedia.org/wiki/Symbolic_link">symbolic link</a> with
the configuration filename pointing to the one you want?</p>
<p>Why not add a command line option in which the user can select which
configuration file should be loaded?</p>
<p>This would make their life <em>and yours</em> easy.</p>
<p>Also, be aware that, today, there may be libraries to handle command line in
every language, which will help you build a good command line interface, along
with standardizing it to have the same interface as other applications.</p>
<div>
<div style="float:left">
&lt;&lt; <a href="&#x2F;books&#x2F;things-i-learnt&#x2F;config-file">The Config File Is Friend</a>
</div>
&nbsp;
<div style="float:right">
<a href="&#x2F;books&#x2F;things-i-learnt&#x2F;application-composition">Not Just Function Composition, But Application Composition</a> &gt;&gt;
</div>
</div>
</div>
</div>
</body>
</html>