Skip to content
This repository was archived by the owner on Apr 10, 2022. It is now read-only.

Commit daebe51

Browse files
committed
修改程序 usage 和参数检查
1 parent e5718b1 commit daebe51

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Hiplot plugin (self-contained Apps generated by Shiny or other techniques are no
44

55
- `plot.R` : where the core computation implemented.
66
- `ui.json`: UI controls for the plugin.
7-
- `data.json`: set the default arguments to UI widgets and the backend `plot.R.
7+
- `data.json`: set the default arguments to UI widgets and the backend `plot.R`.
88
- `meta.json`: set plugin metadata like author, emails, etc.
99
- `README.md`: detail usage of the plugin in English.
1010
- `README.zh_cn.md`: detail usage of the plugin Chinese.

hisub.R

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,21 @@ if (length(Args) == 1) {
9191
write_lines(TEMPLATE, file = "source.R")
9292
message("Done")
9393
quit("no")
94+
} else {
95+
if (file.exists(Args[1])) {
96+
Args[2] <- getwd()
97+
} else {
98+
message("The first argument should be 'template' or a R script file path for generating plugin.")
99+
quit("no", -1)
100+
}
94101
}
95102
}
96103

97104
if (length(Args) == 0) {
98105
message("No operations detected.")
99106
message("Usage:")
100-
message("\t[hisub template] to generate a template.")
101-
message("\t[hisub source.R ... outdir] to convert R script to Hiplot plugin.")
107+
message("\t`hisub template` to generate a template.")
108+
message("\t`hisub source.R [...] [outdir]` to convert R script to Hiplot plugin.")
102109
message("\nDetails see <https://github.com/hiplot/hiplot-plugin-generator>")
103110
quit("no", -1)
104111
}

0 commit comments

Comments
 (0)