meson icon indicating copy to clipboard operation
meson copied to clipboard

meson subprojects: add status and gitignore commands

Open gerion0 opened this issue 1 year ago • 0 comments

This PR adds two new subcommands to meson subprojects: status and gitignore. For both, I added a test project within test cases but no actual test case.

status: Print the overall status of subprojects.

This command has both an ASCII mode and Graphviz DOT mode. In the ASCII mode it prints on the test project:

% ../../../meson.py subprojects status
|- just_folder (folder)
|- just_wrap (wrap, git)
|- nested (wrap, folder, git)
|  |- inner
|  |  `- deep
|  `- used_two_times
|- used_two_times (wrap, folder, git)
|- with_wrap (wrap, folder, git)
|
|- deep (redirect)
`- inner (redirect)

and generates the following graph with ../../../meson.py subprojects status --to-dot > graph.dot: graph

gitignore: Generate a .gitignore file specifically for the subprojects

It can optionally write it into the file. For the test project, this results in this file (subprojects/.gitignore):

# This file was autogenerated with `meson subprojects gitignore`.

# ignore all directories except packagefiles
*/
!packagefiles

# ignore redirects
deep.wrap
inner.wrap

# Meson will not change anything below this line.

Currently missing or can be improved

  • Bash/ZSH completions (will add, when the commands are finalized, since I have no experience in that, help welcome)
  • Colors in the status ASCII output (currently its printed bold only). Maybe colors make sense to mark some attributes (subprojects with a folder are green, etc.)
  • Test cases? Do they exist for subproject commands?

gerion0 avatar Feb 26 '24 19:02 gerion0