Skip to content
This repository has been archived by the owner on Jan 1, 2022. It is now read-only.

Conflicting arguments in group only work for first group in YAML file #182

Open
2 tasks done
epage opened this issue Dec 6, 2021 · 5 comments
Open
2 tasks done

Comments

@epage
Copy link
Owner

epage commented Dec 6, 2021

Issue by DocKDE
Friday Mar 12, 2021 at 16:01 GMT
Originally opened as clap-rs/clap#2409


Please complete the following tasks

  • I have searched the discussions
  • I have searched the existing issues

Rust Version

1.50.0

Clap Version

3.0.0-beta.2

Minimal reproducible code

name: pdbman
version: "0.1"
author: Me
about: Does stuff

settings: [DeriveDisplayOrder, ArgRequiredElseHelp, ColoredHelp, ColorAlways]
    # - UnifiedHelpMessage
    # - DeriveDisplayOrder

args:
    - INPUT:
        about: Name of PDB file
        required: true
    - Query:
        about: Query mode
        long: query
        short: Q
    - Analyze:
        about: Analysis mode
        long: analyze
        short: Y
    - Add:
        about: Add mode
        long: add
        short: A
    - Remove:
        about: Remove mode
        long: remove
        short: R
    - Residues:
        about: Residue mode
        long: residues
        short: r
    - Atoms:
        about: Atom mode
        long: atoms
        short: t
    - Sidechain:
        about: Use only sidechains of protein
        long: sidechain
        short: d
        requires:
            - Residues
    - Backbone:
        about: Use only backbones of protein
        long: backbone
        short: b
        requires:
            - Residues
    - QM1:
        about: QM1 region
        long: qm1
        short: q
    - QM2:
        about: QM1 region
        long: qm2
        short: o
    - Active:
        about: Active revion
        long: active
        short: a
    - Infile:
        about: File for list input
        long: file
        short: f
        takes_value: true
    - List:
        about: Command line list
        long: list
        short: l
        takes_value: true
        multiple: true
        use_delimiter: true
    - Sphere:
        about: Calculate sphere around atom. Requires Atom ID and radius in A as arguments.
        long: sphere
        short: s
        takes_value: true
        min_values: 2
        max_values: 2
        conflicts_with:
            - Sidechain
            - Backbone
    - Outfile:
        about: Name of PDB output file
        long: outfile
        short: e
        takes_value: true
    - Overwrite:
        about: Overwrite input PDB file
        long: overwrite
        short: w
  
groups:
    - mode:
        args: [Query, Analyze, Add, Remove]
        required: true
    - partial:
        args: [Sidechain, Backbone]
    - target:
        args: [Atoms, Residues]
    - region:
        args: [QM1, QM2, Active]
    - source:
        args: [File, List, Sphere]
    - output:
        args: [Outfile, Overwrite]

Steps to reproduce the bug with the above code

Use this .yaml for any command line parsing.

Actual Behaviour

When calling the binary like pdbman -QY it fails with error: The argument '--query' cannot be used with '--analyze'. However the same is not true if I call multiple arguments from other groups like so: pdbman -Aqo or pdbman -Qrt. These commands run without error. It appears that only the args from the topmost group in the YAML file are recognized as being mutally exclusive. I verified this by changing their order.

Expected Behaviour

I would expect a command calling arguments from the same group to also fail with this: error: The argument '--residues' cannot be used with '--atoms' if they belong to the same group.

Additional Context

No response

Debug Output

No response

@epage
Copy link
Owner Author

epage commented Dec 6, 2021

Comment by pksunkara
Friday Mar 12, 2021 at 20:04 GMT


Need the command which is failing and the debug output.

@epage
Copy link
Owner Author

epage commented Dec 6, 2021

Comment by pksunkara
Friday Mar 12, 2021 at 20:05 GMT


Basically, the "actual behaviour" sections need actual command runs and their outputs.

@epage
Copy link
Owner Author

epage commented Dec 6, 2021

Comment by DocKDE
Friday Mar 12, 2021 at 20:37 GMT


I updated the section for expected and actual behaviour. Although I must add I'm not sure what you mean by failing commands and debug output. My issue is precisely that there is no failing command when I expected it so there's no debug output I can post.

@epage
Copy link
Owner Author

epage commented Dec 6, 2021

Comment by pksunkara
Saturday Mar 13, 2021 at 05:32 GMT


What you wrote now is good.

@epage
Copy link
Owner Author

epage commented Dec 6, 2021

Comment by pksunkara
Monday May 31, 2021 at 23:40 GMT


@DocKDE Can you please try with the latest master now?

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

No branches or pull requests

1 participant