cf-tool icon indicating copy to clipboard operation
cf-tool copied to clipboard

Allow not having seperate subdirectory for each contest kind and group

Open infalmo opened this issue 4 years ago • 9 comments

In the latest update, cf parse creates the following directory structure $currdirectory/cf/contest/<contest id>/<problem code>. I liked the previous format much better, where the problem would be parsed to $currdirectory/<contest id>/<problem code>.

The new update may be convenient to some, but I prefer you gave an option to omit the sub-directories in the corresponding cf config option. Maybe something like, Enter ~ if you prefer to not have this subdirectory.

infalmo avatar Feb 29 '20 16:02 infalmo

Well, this is an embarrassing problem. cf needs directory to detect where the user is. So I made the decision what you described. But you can enter /cf/contest/ at first. Then cf parse contest 1111 or cf parse 1111 can make you convenient. Because It will only create a 1111/ under the /cf/contest/. Anyway, if you always work in the directory like /cf/contest, cf's behaviors are like the previous version.

xalanq avatar Feb 29 '20 16:02 xalanq

I have to agree with @infixint943 on this one. I don't think that forcing a directory is a good solution. @xalanq maybe you can explain why is the extra folder needed and maybe we could come up with a workaround?

gnojus avatar Feb 29 '20 18:02 gnojus

idea: it's possible to allow the user to configure this. For example

"contest_directory": "cf/contest/%d/%d",
"group_directory": "cf/group/%d/%d/%d"

Update: by reading the config file, it appears that the folder name is configurable (is this documented anywhere?), but is that still requires that there are multiple folders instead of encoding it in the folder name.

user202729 avatar Mar 01 '20 00:03 user202729

If the user only use cf submit, cf needs to get the extra information from the current path. And cf needs to know what's the type of the current contest (gym, contests, acmsguru or groups? E.g. if the contest id is 100001, it could be a gym contest or group contest.). So I create a workspace cf/ which contains different types of the contests. The reason is I don't want to create some extra files in any folder to help cf to detect that extra information.

xalanq avatar Mar 01 '20 04:03 xalanq

idea: it's possible to allow the user to configure this. For example

"contest_directory": "cf/contest/%d/%d",
"group_directory": "cf/group/%d/%d/%d"

Update: by reading the config file, it appears that the folder name is configurable (is this documented anywhere?), but is that still requires that there are multiple folders instead of encoding it in the folder name.

Contests' rounds are always in the folder {cf}/{contest}, gym's rounds are always in the folder {cf}/{gym}, groups' rounds are always in the folder {cf}/{group}. So you can configure the folders' name {cf}, {contest}, {gym}, {group} by cf config I didn't mention this in README because I have not found out how to describe it.

xalanq avatar Mar 01 '20 04:03 xalanq

You can read the source code client/info.go and cmd/args.go to understand why I did that.

xalanq avatar Mar 01 '20 04:03 xalanq

Maybe folder prefix could specify the type? Example folder names: 1234 -> by default to contest 1234 gym123456 -> gym with id 123456 groupXXXXXXXXXX/123456 -> group XXXXXXXXXX, contest id 123456 acmsguru123 (or acm123) -> acmguru problem 123 (We could probably strip out gym too, as it has 6 digits and groups/acmguru are different). User could also modify these prefixes. This way we avoid extra folders.

gnojus avatar Mar 01 '20 09:03 gnojus

Maybe folder prefix could specify the type? Example folder names: 1234 -> by default to contest 1234 gym123456 -> gym with id 123456 groupXXXXXXXXXX/123456 -> group XXXXXXXXXX, contest id 123456 acmsguru123 (or acm123) -> acmguru problem 123 (We could probably strip out gym too, as it has 6 digits and groups/acmguru are different). User could also modify these prefixes. This way we avoid extra folders.

That idea is not bad. But I prefer the workspace haha. Maybe we can add an option to switch 2 different methods. You can try it and pull a request :)

xalanq avatar Mar 01 '20 10:03 xalanq

Suppose your folder structure to be:

  • parent
    • cf
      • group
      • gym
      • 1302

As a temporary workaround, you can use

"folder_name": {
    "acmsguru": "cf/acmsgurfu",
    "contest": "cf",
    "group": "cf/group",
    "gym": "cf/gym",
    "root": "parent"
  }

lucifer1004 avatar Mar 14 '20 07:03 lucifer1004