Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.0.25
current_version = 0.0.26
commit = True
tag = True

Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ newversion.sh
.history
.mypy_cache
*/.mypy_cache
Icon
.DS_Store
Icon?
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log

## 0.0.26 - 2026-02-27

### Added

- `--list-servers` argument for the dainstall command.

## 0.0.23 - 2025-06-12

### Added
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ You can run `dainstall --help` to get more information about how

usage: dainstall [-h] [--apiurl APIURL] [--apikey APIKEY] [--norestart]
[--watch] [--force-restart] [--server SERVER] [--playground]
[--project PROJECT] [--add] [--noconfig] [--debug]
[directory]
[--project PROJECT] [--add] [--noconfig] [--debug]
[--list-servers] [directory]

positional arguments:
directory
Expand All @@ -171,6 +171,8 @@ You can run `dainstall --help` to get more information about how
--add add another server to the .docassemblecli config file
--noconfig do not use the .docassemblecli config file
--debug use verbose logging
--list-servers Lists out the names and urls of all servers in the
.docassemblecli configuration file

For example, you might want to pass the URL and API key in the command
itself:
Expand Down
47 changes: 47 additions & 0 deletions docassemblecli/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,37 @@ def name_from_url(url):
return name


def list_servers():
dotfile = os.path.join(os.path.expanduser("~"), ".docassemblecli")
if os.path.isfile(dotfile):
try:
with open(dotfile, "r", encoding="utf-8") as fp:
env = yaml.load(fp, Loader=yaml.FullLoader)
except Exception as err:
sys.stderr.write(
"Unable to load .docassemblecli file. "
+ err.__class__.__name__
+ ": "
+ str(err)
+ "\n"
)
env = []
else:
env = []
if isinstance(env, dict):
if "apiurl" in env and "name" not in env:
env["name"] = name_from_url(str(env["apiurl"]))
env = [env]
if not isinstance(env, list):
sys.stderr.write("Format of .docassemblecli file is not a list; ignoring.\n")
env = []
return [
(item["name"], item["apiurl"])
for item in env
if isinstance(item, dict) and "name" in item and "apiurl" in item
]


def wait_for_server(playground:bool, task_id, apikey, apiurl):
if playground:
sys.stdout.write("Waiting for server to restart.")
Expand Down Expand Up @@ -395,11 +426,27 @@ def dainstall():
parser.add_argument("--add", help="add another server to the .docassemblecli config file", action="store_true")
parser.add_argument("--noconfig", help="do not use the .docassemblecli config file", action="store_true")
parser.add_argument("--debug", help="use verbose logging", action="store_true")
parser.add_argument(
"--list-servers",
help="list servers in the .docassemblecli config file",
action="store_true",
)
args = parser.parse_args()
if args.norestart and args.force_restart:
return("The --norestart option can cannot be used with --force-restart.")
if args.project and not args.playground:
return("The --project option can only be used with --playground.")
if args.list_servers:
servers = list_servers()
if len(servers) == 0:
sys.stdout.write("No servers found in .docassemblecli\n")
else:
sys.stdout.write("Servers in .docassemblecli:\n")
sys.stdout.write(" Server Name: Server URL\n")
sys.stdout.write(" ------------ ----------\n")
for name, url in servers:
sys.stdout.write(f" {name}: {url}\n")
return
if not args.add:
if args.directory is None:
parser.print_help()
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "docassemblecli"
version = "0.0.25"
version = "0.0.26"
authors = [
{ name = "Jonathan Pyle", email = "jhpyle@gmail.com" },
]
Expand Down