NFOs are a standardized format for documenting a user's scripts, as well as their usage and arguments. They are hosted under a user's "nfo" script (i.e. on @kaitlyn, I would upload `Ckaitlyn`.`Lnfo`). The information is public, and designed to be easily accessible for other scripts.
"the main idea of a standard is other scripts can tie into it; i.e. i'll have ls pull brief usage out to make ls listings more useful, kait will make a fuller man page viewer, etc" - @dtr
The format looks like this:
{
`Nversion`: `V"1.0.0"`, `l// semver, incase we decide on any major structure changes`
`Nscripts`: `V{`
`Nscriptname`: `V{` `l// scriptname isn't literal, for example if this was for` `Ckaitlyn``l.``Lprofiles``l, i would call this profiles`
`Nusage`: `V"{to: \"user\", msg: \"msg\" }"`, `l// usage example, as seen in scripts like` `Fsys``l.``Lmanage``l, generally your "default args"`
`Ndesc`: `V"a description of the purpose of the script, and maybe general use cases"`,
`l// we typically try to use "modes" to categorize arguments, if this applies to your script then they are used like this:`
`Nmodes`: `V[`
{
`Nname`: `V"mode1"`,
`Nargs`: `V[`
{`Nname`:`V"arg1"`,`Ntype`:`V"expected typeof, i.e. string, truthy, object/boolean"`,`Noptional`:`Vfalse`,`Ndesc`:`V"description of argument"`}
],
`Ndesc`: `V"description of mode"`,
`Nreturns`: `V"description of what data to expect in return, i.e. \"object if is_script, otherwise string\""`
}
],
`l// if you don't think your script has "modes" that it can be categorized into, then just use args and returns on the top level, like this:`
`Nargs`: `V[`
{`Nname`:`V"arg1"`, `Ntype`:`V"expected typeof, i.e. string, truthy, object/boolean"`, `Noptional`:`Vtrue`, `Ndesc`:`V"description of argument"`}
],
`Nreturns`: `V"ok object"`,
`Nsubscript`: `Vtrue`, `l// can your script be subscripted?`
`Nscriptor`: `Vfalse`, `l// can your script be used as a scriptor?`
`Ncli`: `Vfalse` `l// can your script be used on the cli?`
}
}
}
As a practical demonstration, here is the source of `Ckaitlyn`.`Lnfo`:
`Yfunction`() {
`Yreturn` {
`Nversion`: `V"1.0.0"`,
`Nscripts`: `V{`
`Nidenticon`: `V{`
`Nusage`: `V"{ info: true }"`,
`Ndesc`: `V"hackmud implementation of http:/\/identicon.net/"`,
`Nargs`: `V[`
{`Nname`:`V"bg"`, `Ntype`:`V"string"`,`Noptional`:`Vtrue`,`Ndesc`:`V"color code for \"background\" pixels, default is z"`},
{`Nname`:`V"box"`, `Ntype`:`V"truthy"`,`Noptional`:`Vtrue`,`Ndesc`:`V"draws a box around generated identicon"`},
{`Nname`:`V"boxc"`,`Ntype`:`V"string"`,`Noptional`:`Vtrue`,`Ndesc`:`V"sets color of box if box is true"`},
{`Nname`:`V"chat"`,`Ntype`:`V"truthy"`,`Noptional`:`Vtrue`,`Ndesc`:`V"sends identicon to specified channel"`},
{`Nname`:`V"fg"`, `Ntype`:`V"string"`,`Noptional`:`Vtrue`,`Ndesc`:`V"color code for \"foreground\" pixels, default is determined by username"`},
{`Nname`:`V"s"`, `Ntype`:`V"string"`,`Noptional`:`Vtrue`,`Ndesc`:`V"string to be hashed for identicon generation. default is caller's username"`}
],
`Nreturns`: `V"string"`,
`Nsubscript`: `Vtrue`,
`Nscriptor`: `Vtrue`,
`Ncli`: `Vtrue`
},
`Nmark`: `V{`
`Nusage`: `Vnull`,
`Ndesc`: `V"marks caller"`,
`Nargs`: [],
`Nreturns`: `V"string"`,
`Nsubscript`: `Vtrue`,
`Nscriptor`: `Vtrue`,
`Ncli`: `Vtrue`
},
`Nparse_specs`: `V{`
`Nusage`: `Vnull`,
`Ndesc`: `V"script-friendly sys.specs output. uses #hs.sys.specs\() if no args, otherwise uses args (whole thing) as specs"`,
`Nargs`: `V"sys.specs string"`,
`Nreturns`: `V"object"`,
`Nsubscript`: `Vtrue`,
`Nscriptor`: `Vtrue`,
`Ncli`: `Vtrue`
},
`Nprofiles`: `V{`
`Nusage`: `V"{ view: \"user\" }"`,
`Ndesc`: `V"public users.inspect profile database"`,
`Nmodes`: `V[`
{
`Nargs`: `V[`
{`Nname`:`V"changelog"`,`Ntype`:`V"truthy"`,`Noptional`:`Vtrue`,`Ndesc`:`V"displays script changelog history"`}
],
`Ndesc`: `V"defaults"`,
`Nreturns`: `V"string"`
},
{
`Nname`: `V"add"`,
`Nargs`: `V[`
{`Nname`:`V"add"`,`Ntype`:`V"string"`,`Noptional`:`Vfalse`,`Ndesc`:`V"user whose profile to add to the database"`},
{`Nname`:`V"s"`,`Ntype`:`V"scriptor"`,`Noptional`:`Vfalse`,`Ndesc`:`V"users.inspect scriptor, to view user's profile. can be circumvented with kaitlyn.highsec_profiles"`}
],
`Ndesc`: `V"when both add and s are passed, and a channel (or hardline connection) is shared with user specified in add, adds user to the database."`,
`Nreturns`: `V"database object if is_script, otherwise string"`
},
{
`Nname`: `V"view"`,
`Nargs`: `V[`
{`Nname`:`V"name"`,`Ntype`:`V"string"`,`Noptional`:`Vfalse`,`Ndesc`:`V"user whose profile to view"`,`Naliases`:`V[`"view"]},
],
`Ndesc`: `V"displays profile of specified user."`,
`Nreturns`: `V"database object if is_script, otherwise string"`
},
{
`Nname`: `V"list"`,
`Nargs`: `V[`
{`Nname`:`V"list"`,`Ntype`:`V"truthy/number"`,`Noptional`:`Vfalse`,`Ndesc`:`V"activates list mode. if number, takes the place of page"`},
{`Nname`:`V"page"`,`Ntype`:`V"number"`,`Noptional`:`Vtrue`,`Ndesc`:`V"page of list to view."`}
],
`Ndesc`: `V"displays a paginated list of (unhidden) profiles, or an unpaginated list if page is \"all\"."`,
`Nreturns`: `V"string"`
},
{
`Nname`: `V"search"`,
`Nargs`: `V[`
{`Nname`:`V"search"`,`Ntype`:`V"object"`,`Noptional`:`Vfalse`,`Ndesc`:`V"mongodb-style query object"`}
],
`Ndesc`: `V"searches full database, including hidden profiles, using provided query. please play nice"`,
`Nreturns`: `V"string"`
},
{
`Nname`: `V"data"`,
`Nargs`: `V[`
{`Nname`:`V"data"`,`Ntype`:`V"string"`,`Noptional`:`Vfalse`,`Ndesc`:`V"which dataset to view. currently supports avatars, badges, or titles"`}
],
`Ndesc`: `V"returns various datasets"`,
`Nreturns`: `V"object if is_script, otherwise string"`
}
],
`Nsubscript`: `Vtrue`,
`Nscriptor`: `Vtrue`,
`Ncli`: `Vtrue`
},
`Ntop_users`: `V{`
`Nusage`: `Vnull`,
`Ndesc`: `V"pretty users.top output, using data from kaitlyn.profiles for avatar and corp"`,
`Nargs`: `V[`],
`Nreturns`: `V"object if is_script, otherwise string"`,
`Nsubscript`: `Vtrue`,
`Nscriptor`: `Vtrue`,
`Ncli`: `Vtrue`
},
`Nuseful_forum_posts`: `V{`
`Nusage`: `Vnull`,
`Ndesc`: `V"list of useful guides or references from the forums"`,
`Nargs`: `V[`],
`Nreturns`: `V"string"`,
`Nsubscript`: `Vtrue`,
`Nscriptor`: `Vtrue`,
`Ncli`: `Vtrue`
}
}
}
}