Skip to content

Commit

Permalink
added author field
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Feb 14, 2024
1 parent 1a10e64 commit b0e815a
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 5 deletions.
4 changes: 2 additions & 2 deletions cli/src/cli/generate/markdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ pub struct Markdown {
// spec_str: Option<String>,
/// A markdown file taken as input
/// This file should have a comment like this:
/// <!-- usage file="path/to/usage.kdl" -->
#[clap(required_unless_present = "out_dir", value_hint = clap::ValueHint::FilePath)]
/// <!-- [USAGE] load file="path/to/usage.kdl" -->
#[clap(required_unless_present = "out_dir", verbatim_doc_comment, value_hint = clap::ValueHint::FilePath)]
inject: Option<PathBuf>,

/// Output markdown files to this directory
Expand Down
13 changes: 12 additions & 1 deletion examples/docs/MISE_INLINE.md
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,15 @@ Shell type to generate completions for

Shell type to generate completions for

##### Flag `--usage`

Always use usage for completions.
Currently, usage is the default for fish and bash but not zsh since it has a few quirks
to work out first.

This requires the `usage` CLI to be installed.
https://usage.jdx.dev

Examples:

$ mise completion bash > /etc/bash_completion.d/mise
Expand Down Expand Up @@ -1659,7 +1668,9 @@ Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1

## `mise usage`

Generate usage spec
Generate a usage CLI spec

See https://usage.jdx.dev for more information

## `mise use`

Expand Down
9 changes: 9 additions & 0 deletions examples/docs/cli-reference/completion.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ Shell type to generate completions for

Shell type to generate completions for

##### Flag `--usage`

Always use usage for completions.
Currently, usage is the default for fish and bash but not zsh since it has a few quirks
to work out first.

This requires the `usage` CLI to be installed.
https://usage.jdx.dev

Examples:

$ mise completion bash > /etc/bash_completion.d/mise
Expand Down
4 changes: 3 additions & 1 deletion examples/docs/cli-reference/usage.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# `mise usage`

Generate usage spec
Generate a usage CLI spec

See https://usage.jdx.dev for more information
2 changes: 1 addition & 1 deletion examples/mise.usage.kdl
Original file line number Diff line number Diff line change
Expand Up @@ -1186,7 +1186,7 @@ case $cur in
tool="${parts[0]}"
prefix="${parts[1]}"

versions=$(mise ls-remote $tool $prefix | tail -r)
versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d')

for version in $versions; do
echo "$tool@$version"
Expand Down
7 changes: 7 additions & 0 deletions src/parse/spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ pub struct Spec {
pub usage: String,
pub complete: IndexMap<String, Complete>,

pub author: Option<String>,
pub about: Option<String>,
pub long_about: Option<String>,
}
Expand Down Expand Up @@ -65,6 +66,7 @@ impl Spec {
"name" => schema.name = node.arg(0)?.ensure_string()?,
"bin" => schema.bin = node.arg(0)?.ensure_string()?,
"version" => schema.version = Some(node.arg(0)?.ensure_string()?),
"author" => schema.author = Some(node.arg(0)?.ensure_string()?),
"about" => schema.about = Some(node.arg(0)?.ensure_string()?),
"long_about" => schema.long_about = Some(node.arg(0)?.ensure_string()?),
"usage" => schema.usage = node.arg(0)?.ensure_string()?,
Expand Down Expand Up @@ -171,6 +173,11 @@ impl Display for Spec {
node.push(KdlEntry::new(version.clone()));
nodes.push(node);
}
if let Some(author) = &self.author {
let mut node = KdlNode::new("author");
node.push(KdlEntry::new(author.clone()));
nodes.push(node);
}
if let Some(about) = &self.about {
let mut node = KdlNode::new("about");
node.push(KdlEntry::new(about.clone()));
Expand Down

0 comments on commit b0e815a

Please sign in to comment.