Skip to content
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

Add a clash gen command #17

Closed
daxida opened this issue Oct 27, 2023 · 4 comments · Fixed by #31
Closed

Add a clash gen command #17

daxida opened this issue Oct 27, 2023 · 4 comments · Fixed by #31
Assignees
Labels
feature Feature request

Comments

@daxida
Copy link
Collaborator

daxida commented Oct 27, 2023

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 #13 by adding the extra text to the file.

@Andriamanitra Andriamanitra added the feature Feature request label Oct 27, 2023
@Andriamanitra
Copy link
Owner

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?

@ellnix
Copy link
Collaborator

ellnix commented Oct 28, 2023

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.

@Andriamanitra
Copy link
Owner

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"

@ellnix
Copy link
Collaborator

ellnix commented Oct 28, 2023

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.

@ellnix ellnix self-assigned this Nov 2, 2023
@ellnix ellnix mentioned this issue Nov 2, 2023
19 tasks
ellnix referenced this issue in ellnix/coctus Mar 14, 2024
* Allow for uppercase variable names

* Explain rationale behind uppercase check in var name

* Disable uppercase vars for rust stub
ellnix referenced this issue in ellnix/coctus Mar 15, 2024
Fix camel casing pascal cased variables
Allow for uppercase variable names (#17)
* Allow for uppercase variable names
* Explain rationale behind uppercase check in var name
* Disable uppercase vars for rust stub

Fix inconsistent stub variable casing (#18)
* Fix inconsistent stub variable casing
Andriamanitra pushed a commit that referenced this issue Apr 19, 2024
Fix camel casing pascal cased variables
Allow for uppercase variable names (#17)
* Allow for uppercase variable names
* Explain rationale behind uppercase check in var name
* Disable uppercase vars for rust stub

Fix inconsistent stub variable casing (#18)
* Fix inconsistent stub variable casing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Feature request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants