Cli by dirkhh · Pull Request #4697 · subsurface/subsurface

mikeller

RonOnGithub

This gets us the dive list and allows us to retrieve trip and dive details.

This was implemented with some support from Claude Code. All code has been
carefully reviewed and tested.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We needed to fix up the dive data from the dive computers to get the start and
end pressures.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This should only be called from a trusted user or from the Flask webUI, so we
should expect save user input, but it never hurts to be careful...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Also prune back some of the stuff that goes in the core library by default to
reduce the dependencies that we need.

This still includes way too much code that we really don't need, but it's a
start.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We moved the config path into a systemd created / controlled path, but that
wasn't allowed by the CLI.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Those require the branch as part of the spec - so we need to update the
validation as well.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
While dives are named based on the time stamp, trips include the name or
location, and that could introduce refs that weren't valid URLs and that would
break the UI.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This requires a fair bit of ifdef-hell in the shared backend / profile code,
but it does seem "clean enough" to make it worth while...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Also remove some debugging output.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is entirely created by Claude.

It takes advantage of the fact that using git storage as backend is actually
just an implementation detail of the CLI - it simply uses parse_file() to open
a data source, so an XML file is just fine.

The list of tests and the test data need to be manually reviewed and adjusted to
be more meaningful for what we actually want to test - but this seemed like the
fastest way to get "something" that we can start from and adjust to get the type
of testing that we want.

For added fun, I asked Claude to integrate this with some of our CICD builds so
we notice when something breaks the CLI (or breaks the tests). I expect this to
create some false positives at first, but again, it's better to start from
something than from nothing.

I have reviewed the code, so I'm comfortable signing off on it. But I don't
claim that I wrote this.

Created-by: Claude (a couple of minor edits / corrections from me)
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
For the initial usecase of the CLI this isn't needed, but when people build
libdivecomputer for 'normal' use in Subsurface (and not a stripped down version
of it that drops libusb and libmtp from it), the CLI link step will fail
without these dependencies included.

This seemed the smaller of two evils.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The refactoring to allow the profile export included a couple of bugs.

And this also fixes some older bugs. Frankly, I don't understand why the
'return NULL instead of std::string' bugs cause crashes when running the CLI on
certain versions of glibc, yet the full Subsurface seems to run just fine - but
regardless, they clearly are bugs of the "oh I'm so glad that C++ makes our
code so much better" type.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Michael Keller <github@ike.ch>
Consolidate the definition into one place for all build types.

Signed-off-by: Michael Keller <github@ike.ch>
Let's have just one spot where we deal with the character sets and format that
we allow for email (aka Cloud user ID) and password.

I'm aware that this adds QString to a core function. I consider this perfectly
reasonable.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
There are a few subtle problems if the BUILD_PREFIX is a relative path as it
ends up getting used from different working directories.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>