-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Alternative implementation #35
Comments
Hi @andsens, from what I see you still need python for this implementation to work. So, it looks a lot like the previous implementation of docopts, see last python version in the releases. You can see the How woud your version differ from that one? |
Meaning that patched bash script is completely dependency free and works across all platforms. EDIT: Basically, python is a compile-time dependency. |
Hi @andsens, I will look at your script and post back here when I know more about it. It could become a I suppose some code could be borrowed from one or the other.
I also wrote a Proof of Concept Also, some nasty bug may never be fixed in python docopt lib anymore. So to achieve more goal I opted to use golang parser as a base. Which currently look like too much to the python one with the same nasty bug like this one #386 I will be more precise after reading your code. Regards, |
So @andsens I tested your code this morning. It is fast and works well, great job. I far as I understand what you've developed, it seems you wrote your own parser to parse I like parsing too, but didn't have time yet to modify docopt parsing language yet. I feel that docopt should evolve to some point. I've found a couple of issue in docopt that require docopt parser to be modified like: better parse error handling #17 , also in golang docopt/docopt.go#61 , docopt/docopt#190 etc. The original author doesn't seem to maintain the python's code anymore and the python parser seems to be the base for most parser. Including golang parser for docopt which do text object parsing internally exactly as the python's one, I feel it could been done by some more Go internal tricks, having object pointer to some parsed tree object or something that is not stored as string anymore. Rereading docopt/docopt#371 I found that some recent docopt parser raised, it would be great if I could explore it too. About, your request, what I propose you 2 things:
What's your feeling about that? Regards, |
@andsens said:
Oh, I see now. Thanks for the clarification. I had also time to try out I think I think it is worth to add I also think that the names are fitting because |
Hey guys, thank you for the responses and thank you so much for trying it out! I agree that Regarding any bugs in the "reference implementation" @Sylvain303, I will try and see if I can reproduce the linked issue and then fix it. I agree that the developer side errors leave a lot to be desired, luckily for me that is something which can be fixed in python and for which I can send a PR back to |
@andsens So for your repository creation, you may try to contact @mboersma who's is the person I contacted to be granted as maintainer for this repository in #5. About parsing docopt language, so you confirm you've written you own parser for I'm interested in as I mentioned, where should be the best place to exchange about docopt parsing? For the "Alternative implementation", I think we should provide a way to test our examples with both tools. I mean, a way to write example with a middle-ware function so the docopt parsing implementation could be swapable between the two. But the script behavior should stay unchanged. What would you like as a method to increase compatibility for both project? For example option name mangling. Of course, this issue is probably not the place to discuss the example itself, but for a method of working together?
Also documented on both README docopts docopt.sh. What would you suggest as method? |
OK, I will contact @mboersma
No, I may have misspoken there. I started out with how python's docopt was implemented, removed unnecessary stuff for the python part and translated it for the bash part.
I would say wherever feels convenient/appropriate at the time, if we mention each others username it shouldn't make much of a difference.
Now that would be super cool! I think we both have spent quite a bit of time on our respective tests. Something of particular note for my test: I test all bash versions that I say I support.
Definitely. The problem may exist in both parsers, but the solution may be very different and the timeline for solving it as well. So twin issues makes the most sense.
The one for docopt.sh is pretty simple :-) Since nobody is relying on it yet I am free to change it up though. Also: Regarding changing things in docopt.sh. One particular nice thing about the parser being embedded is that I don't need to worry about backwards compatibility so much. I even thought about getting it to check the version number when refreshing a parser and issuing warnings in case the developer needs to be made aware of any changes.
Regarding name mangling? I think predictability is key. Anything else, even usability, should be secondary. That's why I have chosen this rather crude method of just replacing unsupported characters with underscores. Anyone can very easily predict what the variable name is going to be and that makes using it so much easier. |
Oh, interesting, so the parser in your code is mostly took from docopt.
OK. I will probably create an issue on your project, for comparing behavior. May be a wiki page about parsing would be a good place to explain docopt parsing language and referencing useful knowledge? [...]
No, my question was more general about method, for communicating about both project. I'm finishing #32 and I will come back to you about middle-ware for comparing behavior.
|
Hi @andsens, I created the twin issues, in order to test the method of working that way. https://github.com/Sylvain303/docopt.sh/blob/master/examples/compatible.md I don't know yet, if we need to support examples with :
We probably need to provide examples already written in compatible form at the base, instead of trying to write a converter handling most case. I created a draft wiki page to work on the idea: https://github.com/docopt/docopts/wiki/docopts---docopt.sh-comatible-examples It may be more simple to summarize our ideas and goals from a wiki than in an issue discussion. Feel free to edit the wiki page. |
Hi there. I needed a way to parse arguments in my bash scripts without external dependencies, so I wrote docopt.sh. It's an argument parser generator for docopt. I see it as an alternative to your current implementation and was wondering how I would go about getting the repo transferred to the docopt org?
I wrote an email to Vladimir, but he hasn't answered.
The text was updated successfully, but these errors were encountered: