Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Writing Manpage #11399

Closed
bagasme opened this issue May 13, 2020 · 10 comments · Fixed by #13901
Closed

Writing Manpage #11399

bagasme opened this issue May 13, 2020 · 10 comments · Fixed by #13901
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented type/docs This PR mainly updates/creates documentation

Comments

@bagasme
Copy link
Contributor

bagasme commented May 13, 2020

Description

It is convenient to have manpage for viewing Gitea docs (especially Command Line and Config Cheat Sheet) locally.

The manpage will be written using go-md2man as suggested by @lafriks.

The workflow (as described in Hacking doc should be modified to include that any changes to config cheat sheet and/or command line options list docs above, the corresponding changes should also be made onto manpage.

However, how should the manpage be distributed along with Gitea? Currently dl page distribute Gitea as single binary and xz-compressed of it. So I had two options:

  1. Distribute manpage separately, as xz-compressed, or
  2. For compressed archive of Gitea binary, throw manpage into it.
@techknowlogick techknowlogick added the type/docs This PR mainly updates/creates documentation label May 13, 2020
@techknowlogick
Copy link
Member

I believe that https://github.com/urfave/cli the CLI library we use is able to auto generate man pages.

@lafriks
Copy link
Member

lafriks commented May 13, 2020

I think it uses https://github.com/cpuguy83/go-md2man/

@bagasme
Copy link
Contributor Author

bagasme commented May 14, 2020

@techknowlogick i don't see manpage generation on cli docs

@techknowlogick
Copy link
Member

@silverwind
Copy link
Member

silverwind commented May 24, 2020

I see that #11476 adds 2 more markdown source files and I'm not happy about it because if I understand correctly it would require us to change 4 files for each change in the config. Also I think manpage is geared more towards command arguments and should probably only cover those, ideally also not duplicating with --help.

The existing duplication of the config file and the hacking page is already an issue because they constantly get out of sync. I think we should work on something that generates everything from one single source file, maybe in parsable a format like YAML.

@bagasme
Copy link
Contributor Author

bagasme commented May 26, 2020

@silverwind file formats and conventions is also common on manpages (as man 5 /etc/sudoers or similar).

nevertheless, I like your idea of generate docs from single files. What about your suggestion?

@silverwind
Copy link
Member

For config, I could see

configOptions:
  - name: APP_NAME
    default: "Gitea: Git with a cup of tea"
    comment: App name that shows in every page title
  - name: RUN_USER
    default: git
    comment: Change it if you run locally
  - name: RUN_MODE
    default: dev
    comment: Either "dev", "prod" or "test", default is "dev"
  - name: repository.ROOT
    default: ""
    comment: ""
  - name: repository.SCRIPT_TYPE
    default: bash
    comment: ""
  - name: repository.ANSI_CHARSET
    default: ""
    comment: Default ANSI charset

This format should be easy to parse in a script (I'd say either Go, JS or even Python) and it can generate both app.ini.sample and the hacking doc. A similar format could be used for --help and the manpage if you add a key like cliArguments with a similar format.

@zeripath
Copy link
Contributor

Generally I'd say keeping that this next to the code would be better.

Go generally suggests generating other formats from go not generating go from other formats.

In any case Go generate can quite easily reflect on structs to get their tags and if necessary can parse go files and their comments too.

@stale
Copy link

stale bot commented Jul 25, 2020

This issue has been automatically marked as stale because it has not had recent activity. I am here to help clear issues left open even if solved or waiting for more insight. This issue will be closed if no further activity occurs during the next 2 weeks. If the issue is still valid just add a comment to keep it alive. Thank you for your contributions.

@stale stale bot added the issue/stale label Jul 25, 2020
@lunny lunny added the issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented label Jul 27, 2020
@stale stale bot removed the issue/stale label Jul 27, 2020
@6543
Copy link
Member

6543 commented Nov 5, 2020

I think #13429 will close this partially

  • the Config Cheat Sheet still need a solution ...

@go-gitea go-gitea locked and limited conversation to collaborators May 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented type/docs This PR mainly updates/creates documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants