forked from ESCOMP/CTSM
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
1,002 additions
and
193 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Minimal makefile for Sphinx documentation | ||
# | ||
|
||
# You can set these variables from the command line, and also | ||
# from the environment for the first two. | ||
SPHINXOPTS ?= | ||
SPHINXBUILD ?= sphinx-build | ||
SOURCEDIR = . | ||
BUILDDIR = _build | ||
|
||
# Put it first so that "make" without argument is like "make help". | ||
help: | ||
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) | ||
|
||
.PHONY: help Makefile | ||
|
||
# Catch-all target: route all unknown targets to Sphinx using the new | ||
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). | ||
%: Makefile | ||
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Configuration file for the Sphinx documentation builder. | ||
# | ||
# For the full list of built-in configuration values, see the documentation: | ||
# https://www.sphinx-doc.org/en/master/usage/configuration.html | ||
|
||
# -- Project information ----------------------------------------------------- | ||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information | ||
|
||
project = "git-fleximod" | ||
author = "Jim Edwards <[email protected]>" | ||
release = "0.4.0" | ||
|
||
# -- General configuration --------------------------------------------------- | ||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration | ||
|
||
extensions = ["sphinx_argparse_cli"] | ||
|
||
templates_path = ["_templates"] | ||
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] | ||
|
||
|
||
# -- Options for HTML output ------------------------------------------------- | ||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output | ||
|
||
html_theme = "alabaster" | ||
html_static_path = ["_static"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
.. git-fleximod documentation master file, created by | ||
sphinx-quickstart on Sat Feb 3 12:02:22 2024. | ||
You can adapt this file completely to your liking, but it should at least | ||
contain the root `toctree` directive. | ||
Welcome to git-fleximod's documentation! | ||
======================================== | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
:caption: Contents: | ||
.. module:: sphinxcontrib.autoprogram | ||
.. sphinx_argparse_cli:: | ||
:module: git_fleximod.cli | ||
:func: get_parser | ||
:prog: git-fleximod | ||
|
||
|
||
Indices and tables | ||
================== | ||
|
||
* :ref:`genindex` | ||
* :ref:`modindex` | ||
* :ref:`search` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
@ECHO OFF | ||
|
||
pushd %~dp0 | ||
|
||
REM Command file for Sphinx documentation | ||
|
||
if "%SPHINXBUILD%" == "" ( | ||
set SPHINXBUILD=sphinx-build | ||
) | ||
set SOURCEDIR=. | ||
set BUILDDIR=_build | ||
|
||
%SPHINXBUILD% >NUL 2>NUL | ||
if errorlevel 9009 ( | ||
echo. | ||
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx | ||
echo.installed, then set the SPHINXBUILD environment variable to point | ||
echo.to the full path of the 'sphinx-build' executable. Alternatively you | ||
echo.may add the Sphinx directory to PATH. | ||
echo. | ||
echo.If you don't have Sphinx installed, grab it from | ||
echo.https://www.sphinx-doc.org/ | ||
exit /b 1 | ||
) | ||
|
||
if "%1" == "" goto help | ||
|
||
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% | ||
goto end | ||
|
||
:help | ||
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% | ||
|
||
:end | ||
popd |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
from pathlib import Path | ||
import argparse | ||
|
||
__version__ = "0.6.1" | ||
|
||
def find_root_dir(filename=".git"): | ||
d = Path.cwd() | ||
root = Path(d.root) | ||
while d != root: | ||
attempt = d / filename | ||
if attempt.is_dir(): | ||
return attempt | ||
d = d.parent | ||
return None | ||
|
||
|
||
def get_parser(): | ||
description = """ | ||
%(prog)s manages checking out groups of gitsubmodules with addtional support for Earth System Models | ||
""" | ||
parser = argparse.ArgumentParser( | ||
description=description, formatter_class=argparse.RawDescriptionHelpFormatter | ||
) | ||
|
||
# | ||
# user options | ||
# | ||
choices = ["update", "checkout", "status", "test"] | ||
parser.add_argument( | ||
"action", | ||
choices=choices, | ||
default="checkout", | ||
help=f"Subcommand of git-fleximod, choices are {choices[:-1]}", | ||
) | ||
|
||
parser.add_argument( | ||
"components", | ||
nargs="*", | ||
help="Specific component(s) to checkout. By default, " | ||
"all required submodules are checked out.", | ||
) | ||
|
||
parser.add_argument( | ||
"-C", | ||
"--path", | ||
default=find_root_dir(), | ||
help="Toplevel repository directory. Defaults to top git directory relative to current.", | ||
) | ||
|
||
parser.add_argument( | ||
"-g", | ||
"--gitmodules", | ||
nargs="?", | ||
default=".gitmodules", | ||
help="The submodule description filename. " "Default: %(default)s.", | ||
) | ||
|
||
parser.add_argument( | ||
"-x", | ||
"--exclude", | ||
nargs="*", | ||
help="Component(s) listed in the gitmodules file which should be ignored.", | ||
) | ||
parser.add_argument( | ||
"-f", | ||
"--force", | ||
action="store_true", | ||
default=False, | ||
help="Override cautions and update or checkout over locally modified repository.", | ||
) | ||
|
||
parser.add_argument( | ||
"-o", | ||
"--optional", | ||
action="store_true", | ||
default=False, | ||
help="By default only the required submodules " | ||
"are checked out. This flag will also checkout the " | ||
"optional submodules relative to the toplevel directory.", | ||
) | ||
|
||
parser.add_argument( | ||
"-v", | ||
"--verbose", | ||
action="count", | ||
default=0, | ||
help="Output additional information to " | ||
"the screen and log file. This flag can be " | ||
"used up to two times, increasing the " | ||
"verbosity level each time.", | ||
) | ||
|
||
parser.add_argument( | ||
"-V", | ||
"--version", | ||
action="version", | ||
version=f"%(prog)s {__version__}", | ||
help="Print version and exit.", | ||
) | ||
|
||
# | ||
# developer options | ||
# | ||
parser.add_argument( | ||
"--backtrace", | ||
action="store_true", | ||
help="DEVELOPER: show exception backtraces as extra " "debugging output", | ||
) | ||
|
||
parser.add_argument( | ||
"-d", | ||
"--debug", | ||
action="store_true", | ||
default=False, | ||
help="DEVELOPER: output additional debugging " | ||
"information to the screen and log file.", | ||
) | ||
|
||
return parser |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.