Skip to content

Commit

Permalink
Refactor cli commands
Browse files Browse the repository at this point in the history
  • Loading branch information
ggodlewski committed Oct 9, 2023
1 parent 43858e2 commit d280cd1
Show file tree
Hide file tree
Showing 33 changed files with 1,109 additions and 488 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/DevelopServerDeploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ jobs:
-e "ZIPKIN_SERVICE=wikigdrive-develop" \
--link=zipkin:zipkin \
--publish 127.0.0.1:4000:3000 \
"wikigdrive-develop:${GITHUB_SHA}" wikigdrive-ts \
"wikigdrive-develop:${GITHUB_SHA}" wikigdrive \
--service_account /service_account.json \
--share_email [email protected] \
--workdir /data \
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ProdServerDeploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ jobs:
-e "GIT_SHA=${GITHUB_SHA}" \
--publish 127.0.0.1:3000:3000 \
--restart unless-stopped \
"wikigdrive-prod:${GITHUB_SHA}" wikigdrive-ts \
"wikigdrive-prod:${GITHUB_SHA}" wikigdrive \
--service_account /service_account.json \
--share_email [email protected] \
--workdir /data \
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ RUN cd /usr/src/app/apps/ui && npm install && npm run build

WORKDIR "/usr/src/app"

CMD [ "sh", "-c", "wikigdrive-ts --workdir /data server 3000" ]
CMD [ "sh", "-c", "wikigdrive --workdir /data server 3000" ]
21 changes: 1 addition & 20 deletions doc/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,13 @@ wikigdrive init --drive "https://drive.google.com/drive/folders/FOLDER_ID"
--config /location/of/.wgd - Location of config file
--dest /location/of/downloaded/content - Destination for downloaded and converted markdown files
--drive_id - An ID of the drive
--client_id - ID of google app, alternatively can be passed in .env or through environment variable CLIENT_ID;
--client_secret - Secret of google app, alternatively can be passed in .env or through environment variable CLIENT_SECRET;
--link_mode - Style of internal markdown links
--link_mode mdURLs - `/filename.md`
--link_mode dirURLs - `/filename/`
--link_mode uglyURLs - `/filename.html` - see https://gohugo.io/getting-started/configuration/
--without-folder-structure Download documents into single, flat folder
```

List available drive ids that wikigdrive has access to on Google:
Expand All @@ -87,22 +83,7 @@ Run one time documents pull
wikigdrive pull
```

Run continuous documents watch

```
wikigdrive watch --git_update_delay=10
--watch - Run program in loop, watch for gdrive changes
--git_update_delay=x - trigger git update hook after x minutes
```

Status

```
wikigdrive status
```

Run server mode for webhooks support (TODO: not implemented yet)
Run server mode

```
wikigdrive server
Expand Down
4 changes: 2 additions & 2 deletions doc/developer.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ docker run --rm --user=$(id -u) -it \
--publish 127.0.0.1:3000:3000 \
--publish 127.0.0.1:24678:24678 \
wikigdrive \
./src/cli.sh --service_account /service_account.json --share_email [email protected] --workdir /data server 3000
./src/wikigdrived.sh --service_account /service_account.json --share_email [email protected] --workdir /data server 3000
docker rm -f wikigdrive
Expand Down Expand Up @@ -139,7 +139,7 @@ ZIPKIN_URL=http://localhost:9411`
## Debugging

```
./src/cli.sh --inspect --workdir ~/wikigdrive --service_account ~/workspaces/mieweb/wikigdrive-with-service-account.json --share_email [email protected] server 3000
./src/wikigdrived.sh --inspect --workdir ~/wikigdrive --service_account ~/workspaces/mieweb/wikigdrive-with-service-account.json --share_email [email protected] server 3000
```

Chrome
Expand Down
1 change: 0 additions & 1 deletion doc/internals.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
```
{
"drive": "https://drive.google.com/drive/folders/FOLDER_ID",
"drive_id": "",
"dest": "/home/user/mieweb/wikigdrive-test",
"link_mode": "mdURLs",
"service_account": "wikigdrive.json"
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
"npm": ">= 8.1.2"
},
"bin": {
"wgd": "./src/cli.sh",
"wikigdrive": "./src/cli.sh",
"wikigdrive-ts": "./src/cli.sh"
"wgd": "src/wikigdrive.sh",
"wikigdrive": "src/wikigdrive.sh",
"wikigdrivectl": "src/wikigdrivectl.sh"
},
"main": "src/main.ts",
"main": "src/cli/wikigdrive.ts",
"scripts": {
"test": "mocha --require ts-node/register --ui bdd test/*.ts test/**/*.ts",
"lint": "eslint ./apps/**/*.ts ./apps/**/*.vue",
"start": "wikigdrive-ts watch --server 3000",
"start": "wikigdrive server 3000",
"build": ""
},
"repository": {
Expand Down
4 changes: 4 additions & 0 deletions src/ContainerEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ export class ContainerEngine {
return this.containers[name];
}

hasContainer(name: string) {
return !!this.containers[name];
}

async flushData() {
for (const container of Object.values(this.containers)) {
await container.flushData();
Expand Down
Loading

0 comments on commit d280cd1

Please sign in to comment.