Closed daxida closed 2 months ago
I like the idea, although I'm a little bit worried about the potential complexity of supporting a wide variety of languages. The sub-command name should probably be more self-explanatory though, maybe generate-stub
?
How about clash solve
which creates the source file in the current directory with stubs (if any) and opens the default editor?
I think both the stub scripts and the editor should be user configurable like #19. Without a configured editor we could default to simply creating the source file with stubs.
How about
clash solve
which creates the source file in the current directory with stubs (if any) and opens the default editor? I think both the stub scripts and the editor should be user configurable like #19. Without a configured editor we could default to simply creating the source file with stubs.
Personally I think it's better for composability if generating the stub is its own command that users can then combine with other functionality using the full power of their preferred shell rather than some limited configuration format. For example in bash you could do
alias solve="clash stub --python > sol.py && $EDITOR sol.py"
or
alias solve-janet="clash stub | my-janet-stub-gen && $EDITOR sol.janet"
Personally I think it's better for composability if generating the stub is its own command that users can then combine with other functionality using the full power of their preferred shell rather than some limited configuration format. For example in bash you could do
I don't disagree that it would be a good idea to also have a command for just generating the stub, however I disagree that shell aliases are a good user interface.
And also I predict that running a solution will get a lot more complex when you consider languages like Rust, where you would ideally like a cargo project with a preset cargo.toml
which includes common crates.
Add a
clash gen
command similar to https://github.com/kyuridenamida/atcoder-tools that generates the template for solving a clash in a particular language.This could deal with https://github.com/Andriamanitra/clash/issues/13 by adding the extra text to the file.