agrawal-d / cph

Makes judging, compiling, and downloading problems for competitive programming easy.
https://agrawal-d.github.io/cph
GNU General Public License v3.0
815 stars 135 forks source link

problem file name: both short & full #436

Open goyalyashpal opened 6 months ago

goyalyashpal commented 6 months ago

hi!

problem solution

cph.general.useShortCodeForcesName Use a short ID for problem file generated ( like 144C ) instead of the complete problem name for codeforces problems

implementation details

it can be implemented in 2 ways:

  1. (preferred imo) changing the option cph.general.useShortCodeForcesName to be multivalued instead of boolean so, smth like: cph.generatl.fileName: short, full, both, custom

  2. (bad UX imo:) giving different boolean options for each field (shortcode, fullname) and picking some default (like fullname) when all (both for now) are disabled. the format will be: short_full

environment & versions

$ codium --list-extensions --show-versions | grep agrawal
divyanshuagrawal.competitive-programming-helper@6.1.0

$ codium -v
1.89.1
a045dcfceda27f896936bfd8cbf524f6a93a2f46
x64

$ systeminfo | grep -Ei "^os (n|v)|system type"
OS Name:                   Microsoft Windows 10 Home Single Language
OS Version:                10.0.19045 N/A Build 19045
System Type:               x64-based PC

Extension Version: see above VS Code Version: see above Operating System: see above

Browser Version: Vivaldi 6.7.3329.31 (Stable channel) (64-bit) Chrome/124.0.0.0

goyalyashpal commented 5 months ago

previous issues in this lineage:

hitarth-gg commented 4 months ago

I wanted this feature as well and created a fork and added the feature myself. You can check it out here : https://github.com/hitarth-gg/cph-personal-edition It does not add "underscores" but rather adds whitespaces in between, resulting in a file name like this : 144C - Anagram Search.cpp.

goyalyashpal commented 4 months ago

but rather adds whitespaces in between

hi! thanks a lot for making the fork.

but whitespaces are super bad - they complicate the CLI use and require needless escapes, it's the naive & dumbed down windows os environment which doesnt expose the users to how bad whitespace is in filenames.

and whitespace wont work for java files either, as java files require the name to match the classname i.e. follow the rules of identifiers.

hitarth-gg commented 4 months ago

but rather adds whitespaces in between

hi! thanks a lot for making the fork.

but whitespaces are super bad - they complicate the CLI use and require needless escapes, it's the naive & dumbed down windows os environment which doesnt expose the users to how bad whitespace is in filenames.

and whitespace wont work for java files either, as java files require the name to match the classname i.e. follow the rules of identifiers.

I agree with that, that is why I've added a warning in the repo's readme about the whitespaces. I only made this for myself since I rarely have issues with whitespaces on my machine and I don't use CLI that much. You can change the logic in companion.ts file and replace the whitespace with an underscore at line 155 : const secondPart = words?.join(' ');.

goyalyashpal commented 4 months ago

I don't use CLI that much

i would guess that u tried using cmd or powershell shells.

try using bash from msys2 on windows, u will love it.

my affection for cli can be apparent in the issue descriptioy itself, where even the version info is shared via bash lol 😂

rakim-0 commented 1 month ago

@agrawal-d Hi, if you're fine with having this as a feature then I can try working on it o7