[ProgClub programming] Announcing the base() shell function

John Elliot V | ProgClub jj5 at progclub.org
Sun Jun 23 13:46:40 AEST 2019


On 23/6/19 1:31 pm, John Elliot V | ProgClub wrote:
> On 23/6/19 8:06 am, Jedd Rashbrooke wrote:
>> The 'reference implementation' attempts to change the working directory
>> to parent *before* it checks if it's already in in the top level
>> directory.  Nice!
> 
> That's the beauty of the Null Object Pattern [1]. You don't need to check.
> 
> This is a good example of you picking something which doesn't matter and
> leveling accusations against me over it.
> 
> [1] https://en.wikipedia.org/wiki/Null_object_pattern

lol. I misinterpreted "top level" directory. I thought you meant "/" and
were observing that I "cd .." before checking if I'm in "/" (which I
also potentially do, thus my note about the Null Object Pattern).

But when you said "top level" you meant what I've called "base".

And, yes, that is quite deliberate. You have said "Nice!" sarcastically,
but it's actually "Nice!" for realz.

If you're in the base directory of a sub project, my solution will move
you to the parent project base, if there is one. If there isn't one, it
will leave you where you are. This is the best functionality in my view.
Why have multiple calls to base() leave you in a sub project, the base
of which you are already in?

May the Force be with you,
John Elliot V
-- 
|_|O|_| ProgClub
|_|_|O| Because every programmer needs a good club!
|O|O|O| https://www.progclub.org/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jj5.vcf
Type: text/x-vcard
Size: 231 bytes
Desc: not available
URL: <http://www.progclub.org/pipermail/programming/attachments/20190623/cebfa20c/attachment.vcf>


More information about the programming mailing list