MCPcopy Create free account
hub / github.com/OpenFodder/openfodder / format_option

Function format_option

Source/Utils/cxxopts.hpp:1899–1943  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1897 constexpr size_t OPTION_DESC_GAP = 2;
1898
1899 String
1900 format_option
1901 (
1902 const HelpOptionDetails& o
1903 )
1904 {
1905 const auto& s = o.s;
1906 const auto& l = o.l;
1907
1908 String result = " ";
1909
1910 if (!s.empty())
1911 {
1912 result += "-" + toLocalString(s);
1913 if (!l.empty())
1914 {
1915 result += ",";
1916 }
1917 }
1918 else
1919 {
1920 result += " ";
1921 }
1922
1923 if (!l.empty())
1924 {
1925 result += " --" + toLocalString(l);
1926 }
1927
1928 auto arg = !o.arg_help.empty() ? toLocalString(o.arg_help) : "arg";
1929
1930 if (!o.is_boolean)
1931 {
1932 if (o.has_implicit)
1933 {
1934 result += " [=" + arg + "(=" + toLocalString(o.implicit_value) + ")]";
1935 }
1936 else
1937 {
1938 result += " " + arg;
1939 }
1940 }
1941
1942 return result;
1943 }
1944
1945 String
1946 format_description

Callers 1

help_one_groupMethod · 0.85

Calls 2

toLocalStringFunction · 0.85
emptyMethod · 0.45

Tested by

no test coverage detected