Skip to content

Commit

Permalink
Merge pull request #237 from eseiler/fix/format_tdl
Browse files Browse the repository at this point in the history
[FIX] CWL: positional options
  • Loading branch information
eseiler authored Feb 14, 2024
2 parents 3b55514 + fb246f5 commit 4b75957
Show file tree
Hide file tree
Showing 10 changed files with 89 additions and 24 deletions.
19 changes: 11 additions & 8 deletions include/sharg/detail/format_tdl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,15 +298,18 @@ class format_tdl : format_base
++positional_option_count;
auto description = config.description + default_message + validator_message;

parameters.push_back(tdl::Node{
.name = id,
.description = description,
.tags = {},
.value = tdl::StringValue{},
});
if (!config.long_id.empty())
parameters.push_back(tdl::Node{.name = id, .description = description});

auto & node = parameters.back();

if constexpr (detail::is_container_option<option_type>)
{
info.cliMapping.emplace_back("--" + config.long_id, config.long_id);
node.value = tdl::StringValueList{};
}
else
{
node.value = tdl::StringValue{};
node.tags.insert("required");
}
});
}
Expand Down
4 changes: 2 additions & 2 deletions test/api_stability/1.1.1/0001-API-Update-TDL.patch
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From ace25c7fffccdac9ccaf81329ada87f60021b5f9 Mon Sep 17 00:00:00 2001
From 769620513bcc59d257119aacfa06020df7ca45a6 Mon Sep 17 00:00:00 2001
From: Simon Gene Gottlieb <[email protected]>
Date: Thu, 5 Oct 2023 13:43:30 +0200
Subject: [PATCH 1/5] [API] Update TDL
Subject: [PATCH 1/6] [API] Update TDL

---
test/unit/detail/format_ctd_test.cpp | 2 +-
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 7bf847b4991636a59f26ca89977e94f51edfbf11 Mon Sep 17 00:00:00 2001
From 9d8035baa8b0ff4accd6ba2e60a22f779986483d Mon Sep 17 00:00:00 2001
From: Enrico Seiler <[email protected]>
Date: Mon, 5 Feb 2024 16:02:03 +0100
Subject: [PATCH 2/5] [API] Quoted strings and paths
Subject: [PATCH 2/6] [API] Quoted strings and paths

---
test/snippet/readme_sneak_peek.out | 6 ++---
Expand Down
4 changes: 2 additions & 2 deletions test/api_stability/1.1.1/0003-NOAPI-Update-copyright.patch
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From f02ddb2f31a47da16742dbf612d780b328e7602b Mon Sep 17 00:00:00 2001
From a4fffdf64380b018822b13a9ad72586f0564385f Mon Sep 17 00:00:00 2001
From: Enrico Seiler <[email protected]>
Date: Wed, 7 Feb 2024 13:31:22 +0100
Subject: [PATCH 3/5] [NOAPI] Update copyright
Subject: [PATCH 3/6] [NOAPI] Update copyright

---
test/unit/detail/format_help_test.cpp | 10 +++++-----
Expand Down
4 changes: 2 additions & 2 deletions test/api_stability/1.1.1/0004-INFRA-Update-TDL.patch
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 9f040f8ccb8d304841d24d8ac4d67db0d06c370f Mon Sep 17 00:00:00 2001
From 1481f5dfdc68d2d5e04cb5abbec45fab7f15fbcd Mon Sep 17 00:00:00 2001
From: Enrico Seiler <[email protected]>
Date: Fri, 9 Feb 2024 16:17:21 +0100
Subject: [PATCH 4/5] [INFRA] Update TDL
Subject: [PATCH 4/6] [INFRA] Update TDL

---
test/unit/detail/format_cwl_test.cpp | 28 +++++++++++++++++++++++++++-
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 3a7dfd8103806e97af6376e9173d686b67fb5b52 Mon Sep 17 00:00:00 2001
From 085bc1fd63f3c48999610e0a9a916895a7cf9207 Mon Sep 17 00:00:00 2001
From: Enrico Seiler <[email protected]>
Date: Fri, 9 Feb 2024 18:13:36 +0100
Subject: [PATCH 5/5] [INFRA] Use seqan3 main branch
Subject: [PATCH 5/6] [INFRA] Use seqan3 main branch

---
test/unit/detail/CMakeLists.txt | 2 +-
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
From c84f8aeeba0895677c64d9740f4df908674cd0be Mon Sep 17 00:00:00 2001
From: Enrico Seiler <[email protected]>
Date: Wed, 14 Feb 2024 12:34:40 +0100
Subject: [PATCH 6/6] [API][FIX] positional options in CWL/CTD

---
test/unit/detail/format_ctd_test.cpp | 4 ++--
test/unit/detail/format_cwl_test.cpp | 8 ++++----
2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/test/unit/detail/format_ctd_test.cpp b/test/unit/detail/format_ctd_test.cpp
index eb14047..4e9261a 100644
--- a/test/unit/detail/format_ctd_test.cpp
+++ b/test/unit/detail/format_ctd_test.cpp
@@ -42,9 +42,9 @@ struct format_ctd_test : public ::testing::Test
"\n"
R"del( <PARAMETERS version="1.7.0" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/OpenMS/OpenMS/develop/share/OpenMS/SCHEMAS/Param_1_7_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">)del"
"\n"
- R"del( <ITEM name="positional_0" value="" type="string" description="this is a positional option." required="false" advanced="false" />)del"
+ R"del( <ITEM name="positional_0" value="" type="string" description="this is a positional option." required="true" advanced="false" />)del"
"\n"
- R"del( <ITEM name="positional_1" value="" type="string" description="this is a positional option. Default: []" required="false" advanced="false" />)del"
+ R"del( <ITEMLIST name="positional_1" type="string" description="this is a positional option. Default: []" required="false" advanced="false" />)del"
"\n"
R"del( <ITEM name="int" value="5" type="int" description="this is a int option. Default: 5" required="false" advanced="false" />)del"
"\n"
diff --git a/test/unit/detail/format_cwl_test.cpp b/test/unit/detail/format_cwl_test.cpp
index eaf0cad..52079db 100644
--- a/test/unit/detail/format_cwl_test.cpp
+++ b/test/unit/detail/format_cwl_test.cpp
@@ -82,10 +82,10 @@ TEST(format_cwl_test, full_information)
"inputs:\n"
" positional_0:\n"
" doc: this is a positional option.\n"
- " type: string?\n"
+ " type: string\n"
" positional_1:\n"
" doc: \"this is a positional option. Default: []\"\n"
- " type: string?\n"
+ " type: string[]?\n"
" int:\n"
" doc: \"this is a int option. Default: 5\"\n"
" type: long?\n"
@@ -212,10 +212,10 @@ TEST(format_cwl_test, subparser)
"inputs:\n"
" positional_0:\n"
" doc: this is a positional option.\n"
- " type: string?\n"
+ " type: string\n"
" positional_1:\n"
" doc: \"this is a positional option. Default: []\"\n"
- " type: string?\n"
+ " type: string[]?\n"
" int:\n"
" doc: \"this is a int option. Default: 5\"\n"
" type: long?\n"
--
2.43.0

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SPDX-FileCopyrightText: 2006-2024 Knut Reinert & Freie Universität Berlin
SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
SPDX-License-Identifier: BSD-3-Clause
4 changes: 2 additions & 2 deletions test/unit/detail/format_ctd_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ struct format_ctd_test : public ::testing::Test
"\n"
R"del( <PARAMETERS version="1.7.0" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/OpenMS/OpenMS/develop/share/OpenMS/SCHEMAS/Param_1_7_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">)del"
"\n"
R"del( <ITEM name="positional_0" value="" type="string" description="this is a positional option." required="false" advanced="false" />)del"
R"del( <ITEM name="positional_0" value="" type="string" description="this is a positional option." required="true" advanced="false" />)del"
"\n"
R"del( <ITEM name="positional_1" value="" type="string" description="this is a positional option. Default: []" required="false" advanced="false" />)del"
R"del( <ITEMLIST name="positional_1" type="string" description="this is a positional option. Default: []" required="false" advanced="false" />)del"
"\n"
R"del( <ITEM name="int" value="5" type="int" description="this is a int option. Default: 5" required="false" advanced="false" />)del"
"\n"
Expand Down
8 changes: 4 additions & 4 deletions test/unit/detail/format_cwl_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ TEST(format_cwl_test, full_information)
"inputs:\n"
" positional_0:\n"
" doc: this is a positional option.\n"
" type: string?\n"
" type: string\n"
" positional_1:\n"
" doc: \"this is a positional option. Default: []\"\n"
" type: string?\n"
" type: string[]?\n"
" int:\n"
" doc: \"this is a int option. Default: 5\"\n"
" type: long?\n"
Expand Down Expand Up @@ -215,10 +215,10 @@ TEST(format_cwl_test, subparser)
"inputs:\n"
" positional_0:\n"
" doc: this is a positional option.\n"
" type: string?\n"
" type: string\n"
" positional_1:\n"
" doc: \"this is a positional option. Default: []\"\n"
" type: string?\n"
" type: string[]?\n"
" int:\n"
" doc: \"this is a int option. Default: 5\"\n"
" type: long?\n"
Expand Down

0 comments on commit 4b75957

Please sign in to comment.