Skip to content

Improve "help $scriptname" #947

Closed
Closed

Description

@PeridexisErrant

The help command (aliases man, ?) could work much more effectively with scripts. At the moment, it doesn't know anything about script documentation beyond the leading comment. Using the more recent in-script documentation would be a substantial improvement.

The relevant code is at https://github.com/DFHack/dfhack/blob/master/library/Core.cpp#L256
Psudeocode diff, because I can't write C++, looks like

+ if is lua script and "[==== and "]====]" are tokens:
+     return text between tokens
+ if ruby script and "=begin" and "end" are tokens:
+     return text between tokens
  if find_initial_comment():
      return comment
  return "No help found"

It's a pretty simplistic text-extraction trick, but that's how the HTML gets built and it all seems to work there! Simply work out which of the two token sets should be used, and print the text between them if the tokens are present.

Activity

  1. self-assigned this
    on Jun 15, 2016
  2. lethosor commented on Jun 15, 2016

    @lethosor
    Member

    Yeah, I've been meaning to do this for a while.

  3. modified the milestone: 0.43.05-r2 on Jul 15, 2016
  4. modified the milestones: 0.43.05-r3, on Nov 24, 2017
  5. modified the milestones: , on Feb 22, 2018
  6. myk002 commented on Dec 6, 2022

    @myk002
    Member

    this has been implemented for a good while now. closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions