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

More configurable path #70

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

user202729
Copy link
Contributor

@user202729 user202729 commented Mar 2, 2020

cf parse, cf submit and cf clone should work fine now. The rest should be unaffected.


Should fix #67.

I think the current cf clone is incorrect (the directory structure generated cannot be parsed by cf submit) (not tested)

I don't know if there's any part of the code that modifies the other parts of the info. (in that case the path is no longer correct, and it's necessary to store the configuration option in the info object to dynamically compute the path when needed)

% is used to escape the patterns. To have a %, enter two percents. Path separator is always slash, even on Windows. The path specifier is listed in decreasing priority.

The default-generated configuration is the same as the >=0.9.0 behavior. Pre-0.9.0 behavior can be set by something like this

    [
      "contest",
      "%contestID%/%problemID%"
    ],
    [
      "gym",
      "%contestID%/%problemID%"
    ],
    [
      "group",
      "group_%groupID%/%contestID%/%problemID%"
    ],
    [
      "acmsguru",
      "acmsguru/%problemID%"
    ]

@gnojus
Copy link
Contributor

gnojus commented Mar 2, 2020

Maybe use map instead off array in this configuration?
I'm also thinking that we should support comments in config, with something like this: https://github.com/muhammadmuzzammil1998/jsonc.

@user202729
Copy link
Contributor Author

Maybe use map instead off array in this configuration?

->

The path specifier is listed in decreasing priority.

@gnojus
Copy link
Contributor

gnojus commented Mar 2, 2020

Oh. Then I would still prefer something like

[
    {
      "type": "contest",
      "path": "%contestID%/%problemID%"
    },
    {
      "type": "gym",
      "path": "%contestID%/%problemID%"
    },
    {
      "type": "group",
      "path": "group_%groupID%/%contestID%/%problemID%"
    },
    {
      "type": "acmsguru",
      "path": "acmsguru/%problemID%"
    }
]

Just to avoid the inner arrays

@user202729
Copy link
Contributor Author

user202729 commented Mar 3, 2020

The change is actually pretty intrusive -- with the other code unchanged, it's not possible to configure the problem directory path -- so for example it would not be possible to use %contestID%_%problemID%. Since I didn't change the "other code" now it would parse to (contest)/(problem)/(problem)/ directory instead.

@user202729 user202729 closed this Mar 3, 2020
@user202729 user202729 reopened this Mar 3, 2020
Note that this change is config-incompatible with the previous commit, so it may be necessary
to hand-edit the config file.
Path-based detection is not completely reliable because the user may set patterns arbitrarily.
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 this pull request may close these issues.

Allow not having seperate subdirectory for each contest kind and group
2 participants