Skip to content

Commit

Permalink
finish it
Browse files Browse the repository at this point in the history
  • Loading branch information
mcy committed Jul 11, 2024
1 parent 445bd12 commit da19e02
Show file tree
Hide file tree
Showing 14 changed files with 755 additions and 162 deletions.
21 changes: 20 additions & 1 deletion best/cli/cli.cc
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
/* //-*- C++ -*-///////////////////////////////////////////////////////////// *\
Copyright 2024
Miguel Young de la Sota and the Best Contributors 🧶🐈‍⬛
Licensed under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance with the License. You may obtain a copy
of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations
under the License.
\* ////////////////////////////////////////////////////////////////////////// */

#include "best/cli/cli.h"

#include "best/text/format.h"
Expand All @@ -18,4 +37,4 @@ void cli::error::print_and_exit(int bad_exit) const {
std::exit(0);
}
}
} // namespace best
} // namespace best
19 changes: 14 additions & 5 deletions best/cli/cli.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
\* ////////////////////////////////////////////////////////////////////////// */

#ifndef BEST_CLI_FLAGS_H_
#define BEST_CLI_FLAGS_H_
#ifndef BEST_CLI_CLI_H_
#define BEST_CLI_CLI_H_

#include <cstdint>

Expand Down Expand Up @@ -78,7 +78,7 @@ class cli final {
best::str name;

/// The author(s) of the program.
best::str author;
best::str authors;

/// Help text to show when the user runs `--help subcommand`. If not
/// specified, uses `help`.
Expand All @@ -89,6 +89,14 @@ class cli final {

/// A website URL for the program.
best::str url;

/// A copyright year to show in help. This is only shown if `authors` is
/// nonempty.
best::option<uint32_t> copyright_year;

/// A license name to show in help. Ideally this should be an SPDX
/// identifier. This is only shown if `authors` is nonempty.
best::str license;
};

/// # `cli::alias`
Expand Down Expand Up @@ -417,8 +425,9 @@ struct argv_query final {
BestFromArgvQuery(query, best::as_ptr<T>());
}
return query;
}();
}
();
};
} // namespace best

#endif // BEST_CLI_FLAGS_H_
#endif // BEST_CLI_CLI_H_
Loading

0 comments on commit da19e02

Please sign in to comment.