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

Allow not having seperate subdirectory for each contest kind and group #67

Open
infalmo opened this issue Feb 29, 2020 · 9 comments · May be fixed by #70
Open

Allow not having seperate subdirectory for each contest kind and group #67

infalmo opened this issue Feb 29, 2020 · 9 comments · May be fixed by #70

Comments

@infalmo
Copy link

infalmo commented Feb 29, 2020

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.

@xalanq
Copy link
Owner

xalanq commented Feb 29, 2020

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.

@gnojus
Copy link
Contributor

gnojus commented Feb 29, 2020

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?

@user202729
Copy link
Contributor

user202729 commented Mar 1, 2020

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.

@xalanq
Copy link
Owner

xalanq commented Mar 1, 2020

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
Copy link
Owner

xalanq commented Mar 1, 2020

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
Copy link
Owner

xalanq commented Mar 1, 2020

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

@gnojus
Copy link
Contributor

gnojus commented Mar 1, 2020

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.

@xalanq
Copy link
Owner

xalanq commented Mar 1, 2020

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 :)

@user202729 user202729 linked a pull request Mar 2, 2020 that will close this issue
@lucifer1004
Copy link
Contributor

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"
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants