psibi / tldr-hs

Haskell tldr client
BSD 3-Clause "New" or "Revised" License
92 stars 14 forks source link

Add --list argument to list all pages for current platform & common #47

Open sohang3112 opened 4 months ago

sohang3112 commented 4 months ago

In the output of tldr tldr, this is the last sample command (it must be present in the other tldr clients):

 - List all pages for the current platform and common:
   tldr --list

This --list CLI argument should also be added to tldr-hs.

sohang3112 commented 1 month ago

@psibi I would like to work on this & open a Pull Request to add this argument, please confirm that you would be interested in merging a PR for this.

psibi commented 1 month ago

Sounds good to me.

sohang3112 commented 1 month ago

@psibi Ok I'll start working on this. There don't seem to be any Contributing guidelines in this repo - is there anything I should keep in mind while making my PR?

psibi commented 1 month ago

I think you might have to update ci as I haven't touched it in quite sometime. Probably convert it to use GitHub actions if that makes things easier.

sohang3112 commented 1 month ago

@psibi I'm not familiar with Azure CI - can you please explain what's the role of .azure/azure-linux-musl.yaml and .azure/azure-linux-template.yaml ? What does musl stand for or mean? I assume musl YAML is using the template YAML, but I'm not sure how - can you point out on which lines in musl YAML is template YAML file being imported & used?

sohang3112 commented 1 month ago

@psibi I'm having an issue with tldr built from source (running with stack exec tldr) - please help with this issue. In Ubuntu apt repository, tldr command is an older version of tldr-hs. Commands like --version and --update work in the Ubuntu tldr, but not in the version built from source:

# tldr from Ubuntu apt package
$ tldr --version
0.6.4
# running tldr built from source
$ stack exec tldr --version
Invalid option `--version`

Usage: stack exec COMMAND

The commands are defined in src/Tldr/App.hs. For example: (note that this is original source code only, haven't changed anything in any Haskell files):

versionOption :: Parser (a -> a)
versionOption = infoOption (showVersion version) (long "version" <> short 'v' <> help "Show version")

Steps followed to build and run:

stack setup      # install GHC Haskell compiler
stack build      # build executable, installing dependencies
stack test       # install test dependencies and run all tests - all tests pass
stack exec tldr  # runs fine
stack exec tldr --version  # error --version not recognized (full output shown above)

Any idea why the defined commands in the source code are not working? Am I misunderstanding something about building and running from the source? Or is this a bug?

psibi commented 1 month ago

What does musl stand for or mean?

Musl based stack is used for building static Haskell binary.

I assume musl YAML is using the template YAML, but I'm not sure how - can you point out on which lines in musl YAML is template YAML file being imported & used?

I don't think any YAML file is being important. You can probably see an example here of how to use github actions: https://github.com/fakedata-haskell/fakedata/blob/master/.github/workflows/tests.yml

Commands like --version and --update work in the Ubuntu tldr, but not in the version built from source:

Can you try this:

stack exec tldr -- --version

Or is this a bug?

I don't think so as I have latest version in my machine:

❯ tldr --version
0.9.2
sohang3112 commented 1 month ago

stack exec tldr -- --version

Thanks - that worked 👍