Skip to content
This repository has been archived by the owner on Feb 21, 2022. It is now read-only.

Commit

Permalink
cmd/plg: use external package for CLI utility
Browse files Browse the repository at this point in the history
Unfortunately, https://github.com/google/subcommands is very limited and
untested, with ugly help message and lack some niceties out of the box.
I had to write a wrapper in order to have things working, it would be OK
to simply reuse the wrapper across projects if `subcommands` wasn't so
poor.

I have crafted https://github.com/gbrlsnchs/cli myself with my design of
choice, some goodies out of the box and ease in using and testing. Check
the repository for more information.

This is a total rework of the main command interface, but was totally
worth it and necessary. Now it'll be easier to introduce new features.

As a bonus, all integration tests now use the in-memory FS driver for
testing, making it even easier to prototype new functionalities.

fs: resolve slashes in filepath args of methods

This change allows someone using the `fs` package to always use forward
slashes in filepath arguments, regardless of in which OS the program
will run.

fstest: add support for absolute paths

This is not a perfect implementation, far from it. However, it is enough
for current existing tests.

config: move init method to a constructor function

It makes much more sense to initialize a new configuration through a
constructor function. By doing this, it also makes more sense now to
have functional options that set the configuration initialization,
instead of accepting maps as parameters.
  • Loading branch information
gbrlsnchs committed Apr 17, 2020
1 parent c55bec3 commit ee48b06
Show file tree
Hide file tree
Showing 84 changed files with 2,520 additions and 1,464 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ So, for `zsh`, we need to change the following:

To do so, we run:
```shell
$ plg config -file=zsh -basedir='$HOME' -link='' -targets=zprofile,zshrc
$ plg config -basedir='$HOME' -link='' -targets=zprofile,zshrc zsh
```

<kbd>**Hint:**</kbd> Pilgo substitutes environment variables in order for your `pilgo.yml` to be more portable.
Expand All @@ -122,8 +122,8 @@ As said before, one advantage of using Pilgo is that you can name files however

For both `zprofile` and `zshrc`, we'll need to configure them to have a custom name when symlinked:
```shell
$ plg config -file=zsh/zprofile -link=.zprofile
$ plg config -file=zsh/zshrc -link=.zshrc
$ plg config -link=.zprofile zsh/zprofile
$ plg config -link=.zshrc zsh/zshrc
```

And now, if we run the `show` command again:
Expand Down
152 changes: 0 additions & 152 deletions cmd/internal/command/command.go

This file was deleted.

Loading

0 comments on commit ee48b06

Please sign in to comment.