skygragon / leetcode-cli

A cli tool to enjoy leetcode!
MIT License
3.65k stars 458 forks source link

[Feature Request] Use custom code template and filter some lines when submit code #111

Open hiberabyss opened 6 years ago

hiberabyss commented 6 years ago

Is it possible to use custom template instead of the default code template?

When wrote go code, I would like to write some unit test to run the code locally, to accomplish this, the line package main need to be added into the source file. It would be convenient if I could generate go code with following template:

package main
<%= code %>

Then when submit code, the line package main should be filtered out.

Thanks!

skygragon commented 6 years ago

What you expected sound like a plugin as what https://github.com/skygragon/leetcode-cli-plugins/blob/master/docs/cpp.run.md does. And I'm afraid you might need more stub codes than a single "package main" to make go your go code running locally (e.g. definition for tree/list used in leetcode.com)?

skygragon commented 6 years ago

Also would appreciate if you or someones would share your new template as a "go.run" plugin if possible. :p