JMU-CS / JMU-CS/less-java

Native argument parsing

Đang mở
#63 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
enhancement proposal
Ngôn ngữ chính
Java
Star
6
Fork
7
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

Argument parsing is so common that it should be built into the language. For example [Docopt Strings](http://docopt.org/) should be automatically recognized. This should not require imports or configuration in the code by the user. They should be responsible for the docstring and that is all. Remembering the syntax and symantics of docstring itself can also be tedious. LJ should provide a command line tool that aids in generating this string.

Examples
```
"""
Hello, world!

Usage:
hello_world
hello_world -h | --help
hello_world --version

Options:
-h --help Show this screen.
--version Show version.
"""

main() {
printf("Hello, world!, from %s", author)
}
```
This example uses multi line comment syntax similar to docstrings in python. This is just for the purpose of the example. This example also demonstrates the `author` variable being in scope due to the docstring. This is also just for the purpose of the example. We may want to explore having an implicit `arg` map or similar.

```
$ lj docstring --name "Hello,world!" hello_world
$ ... #print docstring shown in previous example
```
This cli would need to be easy enough to use that a user wouldn't need to google docopt everytime they need to do some argument parsing.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.