# Made a new CLI tool

**URL:** https://forum.syncthing.net/t/made-a-new-cli-tool/18064
**Category:** Development
**Created:** [February 19, 2022, 12:28pm UTC](https://forum.syncthing.net/t/made-a-new-cli-tool/18064 "2022-02-19T12:28:42Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![tenox](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/t/d78d45/32.png) [@tenox](https://forum.syncthing.net/u/tenox)
#### Post date: [February 19, 2022, 12:28pm UTC](https://forum.syncthing.net/t/made-a-new-cli-tool/18064/1 "2022-02-19T12:28:43Z")

</div>

I manage a large fleet of Syncthing machines over remote links often slow and high latency. Web UI became somewhat of a burden so I wrote this quick and simple CLI tool in Go using Syncthing API. For now it just displays a dashboard/status of folders and devices.

```
$ stc --apikey=XXXXXX --target=http://127.0.0.1:8384
Host Uptime CPU% Version
homenas 2 weeks 0.0% v1.19.0

Folder Paused State Global Local
pics false idle 37 GB 37 GB
docs false idle 4 GB 4 GB
backups false idle 86 GB 86 GB

Device Paused Conn Sync% Download Upload
office false true 100.0% 11 kB 11 kB
laptop false false 100.0% 0 B 0 B
jakob-home false true 100.0% 89 MB 447 kB
backupnas false true 100.0% 6.3 kB 7.0 kB
homenas false true 100.0% 0 B 0 B

```

Planning to add various actions available in the API as POST in a subsequent release.

Please send comments, remarks, bugs/issues, etc.

> **[GitHub - tenox7/stc: Syncthing CLI Tool](https://github.com/tenox7/stc)**
>
> Syncthing CLI Tool. Contribute to tenox7/stc development by creating an account on GitHub.

a

---

<div class="post-metadata">

### Author: ![tomasz86](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/t/96bed5/32.png) [@tomasz86](https://forum.syncthing.net/u/tomasz86)
#### Post date: [February 19, 2022, 1:59pm UTC](https://forum.syncthing.net/t/made-a-new-cli-tool/18064/2 "2022-02-19T13:59:42Z")

</div>

I like the simplicity of the output 🙂.

Just two comments:

1. Windows binaries need to end with `.exe` in order to be executable.

2. This doesn’t work with HTTPS, does it? I get the following output when trying to access Syncthing.

---

<div class="post-metadata">

### Author: ![acolomb](https://forum.syncthing.net/user_avatar/forum.syncthing.net/acolomb/32/11343_2.png) [@acolomb](https://forum.syncthing.net/u/acolomb)
#### Post date: [February 19, 2022, 6:29pm UTC](https://forum.syncthing.net/t/made-a-new-cli-tool/18064/3 "2022-02-19T18:29:04Z")

</div>

You could add this to the contribution section in our documentation. Feel free to make a PR for this at [https://github.com/syncthing/docs](https://github.com/syncthing/docs)

---

<div class="post-metadata">

### Author: ![tenox](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/t/d78d45/32.png) [@tenox](https://forum.syncthing.net/u/tenox)
#### Post date: [February 19, 2022, 9:52pm UTC](https://forum.syncthing.net/t/made-a-new-cli-tool/18064/4 "2022-02-19T21:52:01Z")

</div>

Right, I forgot about that. I will fix .exes later… Also thanks for the cert info. I can add a flag to ignore cert errors.

---

<div class="post-metadata">

### Author: ![tenox](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/t/d78d45/32.png) [@tenox](https://forum.syncthing.net/u/tenox)
#### Post date: [February 20, 2022, 10:27am UTC](https://forum.syncthing.net/t/made-a-new-cli-tool/18064/5 "2022-02-20T10:27:06Z")

</div>

The cert error is fixed now with a new flag `--ignore_cert_errors`.

---

<div class="post-metadata">

### Author: ![tomasz86](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/t/96bed5/32.png) [@tomasz86](https://forum.syncthing.net/u/tomasz86)
#### Post date: [February 20, 2022, 11:28am UTC](https://forum.syncthing.net/t/made-a-new-cli-tool/18064/6 "2022-02-20T11:28:09Z")

</div>

I’m trying out the new release right now, but I only keep getting the following error.

```
invalid character 'N' looking for beginning of value

```

This is under Windows 10 and happens with both 386 and amd64 versions.

**Edit** : I’ve just seen there are `arm64-android` versions too. Is there a specific reason for limiting Android releases to arm64 only?

---

<div class="post-metadata">

### Author: ![tenox](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/t/d78d45/32.png) [@tenox](https://forum.syncthing.net/u/tenox)
#### Post date: [February 21, 2022, 7:07am UTC](https://forum.syncthing.net/t/made-a-new-cli-tool/18064/7 "2022-02-21T07:07:35Z")

</div>

TBH I have not tested it under Windows yet. I probably should do it now.

As for Android and iOS I think they just built because go has targets for them. I don’t really support them and will probably remove the binaries. These are not phone apps as there is no UI.

---

<div class="post-metadata">

### Author: ![tenox](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/t/d78d45/32.png) [@tenox](https://forum.syncthing.net/u/tenox)
#### Post date: [February 21, 2022, 8:10am UTC](https://forum.syncthing.net/t/made-a-new-cli-tool/18064/8 "2022-02-21T08:10:34Z")

</div>

The error `invalid character 'N' looking for beginning of value` comes up when invalid API key is specified, I need to see why it’s not saying “Not Authorized”, which comes from the REST API. I suspect that `N` is beginning of “Not…”

---

<div class="post-metadata">

### Author: ![tomasz86](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/t/96bed5/32.png) [@tomasz86](https://forum.syncthing.net/u/tomasz86)
#### Post date: [February 21, 2022, 8:51am UTC](https://forum.syncthing.net/t/made-a-new-cli-tool/18064/9 "2022-02-21T08:51:07Z")

</div>

> [@tenox](#):
>
> TBH I have not tested it under Windows yet. I probably should do it now.

Tested again, and that was my mistake. The API key was correct, but the GUI port was not. The current binaries do work in Windows.

> [@tenox](#):
>
> As for Android and iOS I think they just built because go has targets for them. I don’t really support them and will probably remove the binaries. These are not phone apps as there is no UI.

For the record, the standard linux binaries can be executed in Android from the command line and they do run fine there 😉.

---

<div class="post-metadata">

### Author: ![tenox](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/t/d78d45/32.png) [@tenox](https://forum.syncthing.net/u/tenox)
#### Post date: [February 21, 2022, 10:18am UTC](https://forum.syncthing.net/t/made-a-new-cli-tool/18064/10 "2022-02-21T10:18:25Z")

</div>

Okay bugs fixed, tested on Windows too.

Stc can now find apikey and target on it’s own if it’s placed in Syncthing home dir, or you specify it as a flag `--homedir=`.

> **[Release 1.2 · tenox7/stc](https://github.com/tenox7/stc/releases/tag/1.2)**
>
> Ignore cert errors
> Http error codes like unauthorized
> Highlight local host
> Out of sync data
> Find apikey and target in config.xml in homedir

---

<div class="post-metadata">

### Author: ![tenox](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/t/d78d45/32.png) [@tenox](https://forum.syncthing.net/u/tenox)
#### Post date: [February 21, 2022, 11:23am UTC](https://forum.syncthing.net/t/made-a-new-cli-tool/18064/11 "2022-02-21T11:23:35Z")

</div>

I’m also wondering perhaps instead of developing this on it’s own I should be adding this stuff to syncthings own `cli` command?

---

<div class="post-metadata">

### Author: ![acolomb](https://forum.syncthing.net/user_avatar/forum.syncthing.net/acolomb/32/11343_2.png) [@acolomb](https://forum.syncthing.net/u/acolomb)
#### Post date: [March 3, 2022, 11:37am UTC](https://forum.syncthing.net/t/made-a-new-cli-tool/18064/12 "2022-03-03T11:37:09Z")

</div>

Congrats on the v1.3 release @tenox. I noticed among the commands you added, there is some duplication regarding the built-in `syncthing cli` command. Could be worth aligning with that, or just leaving out those commands that are already in the official CLI? Stuff like `restart` and `shutdown`.

Ideally, one should be able to add an `alias stc=syncthing cli` and use the same commands. Or just leave them out of stc and refer to the already implemented ones. Some nice additions of yours would certainly be welcome in the official repo as PRs. That would also make eventual integration into the main CLI easier.

One more nit: The `APIKEY` environment variable you introduced could be aligned to the official (but undocumented!) `STGUIAPIKEY` / `STGUIADDRESS` variable names. So if you start Syncthing and then use stc in the same environment, things work magically when the variables were specified.

---

<div class="post-metadata">

### Author: ![rasa](https://forum.syncthing.net/user_avatar/forum.syncthing.net/rasa/32/10531_2.png) [@rasa](https://forum.syncthing.net/u/rasa)
#### Post date: [March 8, 2022, 7:13am UTC](https://forum.syncthing.net/t/made-a-new-cli-tool/18064/13 "2022-03-08T07:13:43Z")

</div>

On Windows, you can install stc via

```
scoop bucket add rasa https://github.com/rasa/scoops
scoop update
scoop install rasa/stc

```
