Commit Graph

45 Commits

Author SHA1 Message Date
Alexis Sellier 0a93fa833e
cli: Simplify & improve CLI output
Improvements to the CLI output as well as converging towards
`termion` as a backend.

The crates we were using for prompting and spinners were based on
a terminal backend called `console`, which is not really used
anywhere else. There were also limitations in terms of the output
of these crates.

Therefore, we switched to the `inquire` crate for prompting, using
the `termion` backend, which is very standard.

Additionally, we simplify the terminal output to use symbols:

! for Warning
✓ for Success
✗ for Error

... Instead of a mix of words and symbols.

We also include a modified version of the `yansi` crate which plays
well with our table formatting functions by automatically truncating
and padding output in a unicode-aware way.
2023-02-27 17:10:52 +01:00
Alexis Sellier 7e1b2b6222
crypto: Cleanup `hash` module
Remove `Digest` type and use `ssh-key` for formatting public ssh key.
2023-02-17 10:51:27 +01:00
Fintan Halpenny ef0628c48e
Exchange From for TryFrom for PathBuf and Home
The `From` implementation would allow someone to create a `Home` in an
incorrect fashion, for example the path is not canonical.

Exchange `From` for a `TryFrom` implementation.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-02-17 10:37:39 +01:00
Sebastian Martinez b04451a1bd
Use `Did` in a bunch more places
Instead of showing just public keys we need to show the fully qualified
spec for a NID which is prefixed by `did🔑` While we want to maintain
`Author` and `ActorId` for internal use.

Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-02-16 18:01:42 +01:00
Fintan Halpenny 5477a3615f
radicle-cli: use Did across CLI
The CLI commands and output use PublicKey, ActorId, and NodeId for
peer identifiers.

Instead Did should be standardised for use in CLI arguments and
outputs.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-02-16 17:07:14 +01:00
Vincenzo Palazzo b9ed0bc4cb
cli: Add `rad patch checkout`
This commit allows to checkout a patch created
with `rad patch open` in a new branch
named `patch/{short_patch_id}`.

Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2023-02-15 14:06:04 +01:00
Vincenzo Palazzo ff52ea7223
cli: Show patch id when we run `rad patch list`
This commit includes a simplification in finding the
long patch id in order to perform operations like
`patch show <id>` and `patch checkou <id>`.

Actual output

```
➜  rio git:(main) rad patch list

- YOU PROPOSED -

patch text 8c94760699e R0 f1b2740 (macros/rad_patch) ahead 1, behind 0
└─ * opened by z6MkuvfwAkZ6yD6Z5TT6YXfJjFNPMQz9fPi9BSU7gwhS9s2x (you) 12 minutes ago
└─ * patch id 8c94760699e3e2da64aa9f14f4d2cecfe7b754ad

patch text 78e0fb5ad45 R0 f1b2740 (macros/rad_patch) ahead 1, behind 0
└─ * opened by z6MkuvfwAkZ6yD6Z5TT6YXfJjFNPMQz9fPi9BSU7gwhS9s2x (you) 24 minutes ago
└─ * patch id 78e0fb5ad45481d225a6fb45f51422e468b55c94

- OTHERS PROPOSED -

Nothing to show.

```

Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2023-02-15 14:00:55 +01:00
Fintan Halpenny e7c929898a
cli: add Identity::current to output
Add the resulting SHA of the new Identity when performing `rad id
commit`.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-02-13 18:02:23 +01:00
Fintan Halpenny 6b674a38c1
cli: rad id example
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-02-13 13:50:52 +00:00
Sebastian Martinez 881e9af219
httpd: Add `assignees` to `Issues::create`
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-02-13 13:47:15 +01:00
Alexis Sellier 3e7761740f
node: Rely on inventory announcement in `rad init` 2023-02-13 09:59:44 +01:00
Alexis Sellier 27d0c8f235
cli: Track projects we initialize 2023-02-12 16:48:46 +01:00
xphoniex bdc0ab9881
Update `radicle-git` and `radicle-surf`
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-02-10 22:14:50 +01:00
Adam Szkoda 93ba7f593c
cli: Fix a test failing on macos: rad_checkout 2023-02-10 15:01:06 +01:00
Alexis Sellier b2dbf12862
cli: Fix `rad rm` command 2023-02-10 12:56:11 +01:00
Sebastian Martinez a57b33c785
httpd: Add `api::test::patch` request method
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-02-10 12:17:03 +01:00
Slack Coder 02c07d7be1
cli: Test rad-clone is deterministic
The last commit of a newly cloned repository should remain untouched by
making `Node::project()` use a repository fixture instead of a randomly
generated one.

Signed-off-by: Slack Coder <slackcoder@server.ky>
2023-02-09 16:49:52 +01:00
Slack Coder ac812d7834
rad: Add comment `reply-to`
Allow replying to patch and issue comments using `rad comment --reply-to` option.

Signed-off-by: Slack Coder <slackcoder@server.ky>
2023-02-09 16:42:47 +01:00
Alexis Sellier b108342fab
cli: Test clone failure for unknown repo 2023-02-08 21:28:59 +01:00
Alexis Sellier 69ac8be8fd
node: Update local routing table on announce 2023-02-08 21:28:49 +01:00
Alexis Sellier 9177e67de6
cli: Use same project for clone test 2023-02-08 20:21:35 +01:00
Slack Coder ed9900b5ac
cli: Support patch commenting
Allow commenting on a patch as well an issue.

Signed-off-by: Slack Coder <slackcoder@server.ky>
2023-02-07 11:16:59 +01:00
Alexis Sellier 2649e9c6fe
cli: Add `rad-clone` test 2023-02-07 10:46:12 +01:00
Slack Coder 3c202564bf
cli: split into patch::create and patch::update
Simplify codebase by splitting patch::create::run() into patch::create::run() and
patch::update::run().

Patch has the subcommands `create` and `update` but both use the same
method to do the heavy lifting.  Spitting the code allows us to detangle
the code path making it easier to follow.

Also, reduce cognitive load by minimizing the amount of variables used
and isolating them to utility functions.  For instance, `head_branch` can be passed to
these methods instead of `head_oid` and `head_branch`.

Signed-off-by: Slack Coder <slackcoder@server.ky>
2023-02-06 13:53:31 +01:00
Slack Coder 215abde9e6
cli: cover `rad patch update` in doc test
Signed-off-by: Slack Coder <slackcoder@server.ky>
2023-02-06 13:49:41 +01:00
Alexis Sellier 5e955d39d0
cob: Add 'description' to `Revision`
Simplifies the code a little.
2023-01-26 17:37:58 +01:00
Alexis Sellier 8279ef72fd
cli: Fix output of checkout command 2023-01-25 17:51:49 +01:00
Alexis Sellier bb135b64b3
cli: Get `rad-checkout` working properly 2023-01-24 14:54:56 +01:00
Slack Coder a0588460f3
cli: More informative `rad patch show`
Show entire patch commit history using `rad log --patch`.
2023-01-20 13:46:02 +01:00
Slack Coder 2295bb4ea4
cli: add `rad patch show`
Show patch information with `rad patch show`.

Signed-off-by: Slack Coder <slackcoder@server.ky>
2023-01-20 13:46:02 +01:00
Slack Coder 9243b9fdeb
cli: Add minimal `rad comment`
Allow users to comment on an Issue.

Signed-off-by: Slack Coder <slackcoder@server.ky>
2023-01-18 18:08:09 +01:00
Slack Coder 54bcb91339
cli: Allow using `git` in doc tests
Define git author name and email address, and others to allow using it
deterministically in documentation tests.

Signed-off-by: Slack Coder <slackcoder@server.ky>
2023-01-17 10:08:44 +01:00
Slack Coder 284aadc37c
cli: Avoid trailing spaces on list
Use '-'s to avoid trailing spaces on items when listing patches.

The spaces are used as part of the format with colouring.  However they
are a nuisance to support in testing given the autoformatting of editors
to remove them.

Signed-off-by: Slack Coder <slackcoder@server.ky>
2023-01-17 10:08:44 +01:00
Slack Coder a6d59b3c0e
cli: alter use subcommands for patch
Make `rad patch` accept subcommands for specifying its operation in
place of the '--command' notation.

For instance `rad patch update` versus `rad patch --update`.  Also make
the default operation list active patches, replacing patch creation.
Patch creation is now done via `rad patch open`.

Make these changes in a way consistent with other commands like `rad
delegate`.

Add '--no-confirm' to patch to support this subcommand's documentation
test.

Signed-off-by: Slack Coder <slackcoder@server.ky>
2023-01-17 10:08:44 +01:00
Slack Coder 897d439f95
radicle-cli: Correct operation name
Change `OperationName::Create` to `OperationName::Open` and change the
command argument to reflect this.

Signed-off-by: Slack Coder <slackcoder@server.ky>
2023-01-12 19:59:43 +01:00
Alexis Sellier a6066e3ac3
cli: Update `inspect` command
Fix order of iteration, and make output look more like commit log.
Also show commit parent and message.

Signed-off-by: Alexis Sellier <self@cloudhead.io>
2023-01-09 16:48:01 +01:00
Alexis Sellier e49226c500
cli: Make some changes to issue listing
* Use an `--assigned` flag
* Default to listing all issues

Signed-off-by: Alexis Sellier <self@cloudhead.io>
2023-01-03 18:59:13 +01:00
Fintan Halpenny aa05f676f7
cli: add delegate cli
Adds a `rad delegate` CLI command.

The command consists of three subcommands:
* `add` -- add a new delegate to the set of delegates of a project
* `remove` -- remove an existing delegate from the set of delegates of a
  project
* `list` -- list the delegates of a project

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2022-12-27 12:25:24 +01:00
Slack Coder 260863f571
cli: list your assigned issues via 'rad issue'
Allow listing issues for a given peer by using 'rad issue list' with an optional
argument.

For convenience, make listing your own issues easy by making it the
default operation of 'rad issue'.

Signed-off-by: Slack Coder <slackcoder@server.ky>
2022-12-26 15:52:14 +01:00
Slack Coder 946d6ac675
cli: assign and unassign issues
Allow assigning an issue to one or more people via a new subcommand.

    rad assign <issue> <peer>

To unassign:

    rad unassign <issue> <peer>

To support testing and documentation, create an example for maintaining
issues for a project.

Signed-off-by: Slack Coder <slackcoder@server.ky>
2022-12-26 15:38:39 +01:00
Alexis Sellier 98c1566109
Make `Doc` type payload generic 2022-12-09 22:05:38 +01:00
Alexis Sellier 66d76d7ab2
radicle: Use `defaultBranch` for payload key
This was changed by mistake from the previous format used in radicle
link. We restore all keys to camel-case.

Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-07 18:01:47 +01:00
Alexis Sellier 207d2133f9
Remove delegate names from identity doc
We are working on other mechanisms to help identify keys, and this
is just redundant.

Also update some of the CLI examples to create a canonical example
for documentation.

Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-07 12:16:00 +01:00
Alexis Sellier e63f334890
cli: Replace `trycmd` with our own test runner
This will allow us to run commands other than `rad`
and to have tests that switch between different users.

Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-06 10:01:38 +01:00
Alexis Sellier e258c72eca
Implement some CLI tests using `trycmd`
I'm not entirely satisfied with `trycmd`, but it's a start.
If we choose to move to a different crate, or implement our own,
we can keep the example test cases.

Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-11-22 10:44:30 +01:00