Skip to content

Commit

Permalink
Merge pull request #67 from toshi0383/man-page
Browse files Browse the repository at this point in the history
Add missing man-pages
  • Loading branch information
toshi0383 authored Feb 16, 2018
2 parents 52344ac + a9c5439 commit 90d3f0b
Show file tree
Hide file tree
Showing 10 changed files with 66 additions and 12 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## master
##### Enhancement
* Add missing man-pages [#67](https://github.com/toshi384/cmdshelf/pull/67)
[Toshihiro Suzuki](https://github.com/toshi0383)

* Use $PAGER for spawning man-page process if specified [#66](https://github.com/toshi384/cmdshelf/pull/66)
[Toshihiro Suzuki](https://github.com/toshi0383)

Expand Down
6 changes: 1 addition & 5 deletions Sources/cmdshelf/Arguments.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@ struct Alias {

enum SubCommand: String {

case run, list, remote, blob, cat, update, help

var possiblyHasManPage: Bool {
return [.list].contains(self)
}
case blob, cat, help, list, remote, run, update
}

// - MARK: ArgumentParser
Expand Down
6 changes: 1 addition & 5 deletions Sources/cmdshelf/Commands.swift
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,7 @@ final class HelpCommand: Command {
return
}
let subCommand = try SubCommandArgument().parse(parser)
if subCommand.possiblyHasManPage {
if spawnPager(cmdString: "man cmdshelf-\(subCommand.rawValue)") != 0 {
queuedPrintln(subCommand.helpMessage)
}
} else {
if spawnPager(cmdString: "man cmdshelf-\(subCommand.rawValue)") != 0 {
queuedPrintln(subCommand.helpMessage)
}
}
Expand Down
15 changes: 15 additions & 0 deletions doc/man/man1/cmdshelf-blob.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.TH "CMDSHELF-BLOB" "1" "February 2018" "cmdshelf 0.9.3" "Cmdshelf Manual"
.SH "NAME"
cmdshelf-blob - Manage blobs
.SH "SYNOPSIS"
\fBcmdshelf blob\fR <command> [<args>]
.SH "DESCRIPTION"
.TP
The blob subcommand manages blobs.
.SH "SUB-COMMANDS"
.SS add <name> <url>
Add a blob named <name> at <url>. <url> can be a network URL or a local filepath.
.SS list
List blobs.
.SS remove <name>
Remove the blob named <name>.
8 changes: 8 additions & 0 deletions doc/man/man1/cmdshelf-cat.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.TH "CMDSHELF-CAT" "1" "February 2018" "cmdshelf 0.9.3" "Cmdshelf Manual"
.SH "NAME"
cmdshelf-cat - Concatenate and print command(s).
.SH "SYNOPSIS"
\fBcmdshelf cat\fR [[<remoteName>:]<command>]
.SH "DESCRIPTION"
.TP
The cat subcommand reads commands script files sequentially, writing them to the standard output.
2 changes: 1 addition & 1 deletion doc/man/man1/cmdshelf-list.1
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
.SH "NAME"
cmdshelf-list - Show all registered commands.
.SH "SYNOPSIS"
\fIcmdshelf list\fR [\-\-path]
\fBcmdshelf list\fR [\-\-path]
.SH "DESCRIPTION"
.TP
The list subcommand lists all commands from remotes and blobs.
Expand Down
15 changes: 15 additions & 0 deletions doc/man/man1/cmdshelf-remote.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.TH "CMDSHELF-REMOTE" "1" "February 2018" "cmdshelf 0.9.3" "Cmdshelf Manual"
.SH "NAME"
cmdshelf-remote - Manage set of tracked repositories
.SH "SYNOPSIS"
\fBcmdshelf remote\fR <command> [<args>]
.SH "DESCRIPTION"
.TP
Manage the set of repositories ("remotes").
.SH "SUB-COMMANDS"
.SS add <name> <url>
Adds a remote named <name> for the repository at <url>.
.SS list
List tracked remotes.
.SS remove <name>
Remove the remote named <name>. This won't remove the cloned local repository. Clean on your own if needed.
13 changes: 13 additions & 0 deletions doc/man/man1/cmdshelf-run.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.TH "CMDSHELF-RUN" "1" "February 2018" "cmdshelf 0.9.3" "Cmdshelf Manual"
.SH "NAME"
cmdshelf-run - Execute command
.SH "SYNOPSIS"
\fBcmdshelf run\fR [<remoteName>:]<command> [<args>]
.SH "DESCRIPTION"
.TP
The run subcommand receives command-alias and whitespace separated list of parameters.
.SH "AVOIDING NAMESPACE CONFLICT"
.TP

The \fBrun\fR subcommand picks up first command matches the <command>. If you have same command names from different remotes, add <\fBremoteName\fR>: prefix to to be explicit.
e.g. cmdshelf run myRemote:echo-sd hello
8 changes: 8 additions & 0 deletions doc/man/man1/cmdshelf-update.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.TH "CMDSHELF-UPDATE" "1" "February 2018" "cmdshelf 0.9.3" "Cmdshelf Manual"
.SH "NAME"
cmdshelf-update - Update cloned local repositories.
.SH "SYNOPSIS"
\fBcmdshelf update\fR
.SH "DESCRIPTION"
.TP
The \fBupdate\fR subcommand updates each cloned repositories.
2 changes: 1 addition & 1 deletion doc/man/man1/cmdshelf.1
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ to see more detailed manual page for each sub-command.
.SS blob
Manage blob commands.
.SS cat
Concatenate and print sourcecodes of commands.
Concatenate and print command(s).
.SS help
Show help message.
.SS list
Expand Down

0 comments on commit 90d3f0b

Please sign in to comment.