Skip to content

Commit

Permalink
fix: move CLI to its own module
Browse files Browse the repository at this point in the history
  • Loading branch information
ozum committed Jan 21, 2021
1 parent d856cff commit 9cd0147
Show file tree
Hide file tree
Showing 11 changed files with 160 additions and 434 deletions.
127 changes: 29 additions & 98 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,9 @@
# not-sync

Disable synchronization for some files in cloud storage such as Dropbox, iCloudDrive or OneDrive. Detects cloud storage provider.
Disable synchronization for files in cloud storage such as Dropbox, iCloudDrive or OneDrive. Detects cloud storage provider.

# Synopsis

## CLI

Disable synchronization for `node_modules`, `dist`, `coverage`.

```sh
$ not-sync node_modules dist coverage
```

Re-enable synchronization for `node_modules`, `dist`, `coverage`.

```sh
$ resync node_modules dist coverage
```

## API

```ts
import { notSync, resync } from "not-sync";
```
Expand Down Expand Up @@ -105,59 +89,6 @@ Target directory can be changed using `targetRoots` option.

<!-- commands -->

# CLI

## not-sync

```sh
USAGE

$ not-sync [options] <path>...

ARGUMENTS

<path>... Path or list of paths (separate with space) to disable syncronization for.

OPTIONS

--cwd Set current working directory for relative paths.
-i --ignoreConfigs (CSV) List of ignore files to update (e.g. .gitignore, .prettierignore).
--dry Prevent changes to be written to disk. Executes a dry run.
-v --verbose Output extra information.
-l --linkSameDir (Default: true) Move files near original file for iCloudDrive. For example 'dist' is moved 'dist.nosync' in same directory.
--help Show help.
--version Show version.

EXAMPLES

$ not-sync --i .gitignore node_modules dist coverage
```
## resync
```sh
USAGE

$ resync [options] <path>...

ARGUMENTS

<path>... Path or list of paths (separate with space) to re-enable syncronization for.

OPTIONS

--cwd Set current working directory for relative paths.
-i --ignoreConfigs (CSV) List of ignore files to update (e.g. .gitignore, .prettierignore).
--dry Prevent changes to be written to disk. Executes a dry run.
-v --verbose Output extra information.
--help Show help.
--version Show version.

EXAMPLES

$ resync --i .gitignore node_modules dist coverage
```
# API

<a name="readmemd"></a>
Expand Down Expand Up @@ -197,79 +128,79 @@ not-sync

Ƭ **MoveErrorCode**: _NOSRC_ \| _LINKEXIST_ \| _NOTALINK_ \| _NOTFOUND_ \| _NOTARGET_

Defined in: [index.ts:6](https://github.com/ozum/not-sync/blob/a26c21f/src/index.ts#L6)
Defined in: [index.ts:6](https://github.com/ozum/not-sync/blob/d856cff/src/index.ts#L6)

---

### OnAddEntry

Ƭ **OnAddEntry**: (`service`: [_ServiceKey_](#servicekey), `ignoreFile`: _string_, `entries`: _string_[]) => _any_ \| _Promise_<_any_\>

Defined in: [index.ts:13](https://github.com/ozum/not-sync/blob/a26c21f/src/index.ts#L13)
Defined in: [index.ts:13](https://github.com/ozum/not-sync/blob/d856cff/src/index.ts#L13)

---

### OnDelete

Ƭ **OnDelete**: (`service`: [_ServiceKey_](#servicekey), `path`: _string_, `type`: _symlink_ \| _parent_) => _any_ \| _Promise_<_any_\>

Defined in: [index.ts:12](https://github.com/ozum/not-sync/blob/a26c21f/src/index.ts#L12)
Defined in: [index.ts:12](https://github.com/ozum/not-sync/blob/d856cff/src/index.ts#L12)

---

### OnDeleteEntry

Ƭ **OnDeleteEntry**: (`service`: [_ServiceKey_](#servicekey), `ignoreFile`: _string_, `entries`: _string_[]) => _any_ \| _Promise_<_any_\>

Defined in: [index.ts:14](https://github.com/ozum/not-sync/blob/a26c21f/src/index.ts#L14)
Defined in: [index.ts:14](https://github.com/ozum/not-sync/blob/d856cff/src/index.ts#L14)

---

### OnFound

Ƭ **OnFound**: (`service`: [_ServiceKey_](#servicekey), `files`: _string_[]) => _any_ \| _Promise_<_any_\>

Defined in: [index.ts:7](https://github.com/ozum/not-sync/blob/a26c21f/src/index.ts#L7)
Defined in: [index.ts:7](https://github.com/ozum/not-sync/blob/d856cff/src/index.ts#L7)

---

### OnMove

Ƭ **OnMove**: (`service`: [_ServiceKey_](#servicekey), `from`: _string_, `to`: _string_) => _any_ \| _Promise_<_any_\>

Defined in: [index.ts:9](https://github.com/ozum/not-sync/blob/a26c21f/src/index.ts#L9)
Defined in: [index.ts:9](https://github.com/ozum/not-sync/blob/d856cff/src/index.ts#L9)

---

### OnMoveFail

Ƭ **OnMoveFail**: (`service`: [_ServiceKey_](#servicekey), `errorCode`: [_MoveErrorCode_](#moveerrorcode), `from?`: _string_, `to?`: _string_) => _any_ \| _Promise_<_any_\>

Defined in: [index.ts:10](https://github.com/ozum/not-sync/blob/a26c21f/src/index.ts#L10)
Defined in: [index.ts:10](https://github.com/ozum/not-sync/blob/d856cff/src/index.ts#L10)

---

### OnNotFound

Ƭ **OnNotFound**: (`files`: _string_[]) => _any_ \| _Promise_<_any_\>

Defined in: [index.ts:8](https://github.com/ozum/not-sync/blob/a26c21f/src/index.ts#L8)
Defined in: [index.ts:8](https://github.com/ozum/not-sync/blob/d856cff/src/index.ts#L8)

---

### OnSymlink

Ƭ **OnSymlink**: (`service`: [_ServiceKey_](#servicekey), `target`: _string_, `path`: _string_) => _any_ \| _Promise_<_any_\>

Defined in: [index.ts:11](https://github.com/ozum/not-sync/blob/a26c21f/src/index.ts#L11)
Defined in: [index.ts:11](https://github.com/ozum/not-sync/blob/d856cff/src/index.ts#L11)

---

### ServiceKey

Ƭ **ServiceKey**: _iCloudDrive_ \| _dropbox_ \| _oneDrive_

Defined in: [cloud-service/cloud-service.ts:24](https://github.com/ozum/not-sync/blob/a26c21f/src/cloud-service/cloud-service.ts#L24)
Defined in: [cloud-service/cloud-service.ts:24](https://github.com/ozum/not-sync/blob/d856cff/src/cloud-service/cloud-service.ts#L24)

## Functions

Expand All @@ -286,7 +217,7 @@ Defined in: [cloud-service/cloud-service.ts:24](https://github.com/ozum/not-sync

**Returns:** _Promise_<_void_\>

Defined in: [main.ts:31](https://github.com/ozum/not-sync/blob/a26c21f/src/main.ts#L31)
Defined in: [main.ts:31](https://github.com/ozum/not-sync/blob/d856cff/src/main.ts#L31)

---

Expand All @@ -303,7 +234,7 @@ Defined in: [main.ts:31](https://github.com/ozum/not-sync/blob/a26c21f/src/main.

**Returns:** _Promise_<_void_\>

Defined in: [main.ts:27](https://github.com/ozum/not-sync/blob/a26c21f/src/main.ts#L27)
Defined in: [main.ts:27](https://github.com/ozum/not-sync/blob/d856cff/src/main.ts#L27)

# Interfaces

Expand Down Expand Up @@ -336,63 +267,63 @@ Defined in: [main.ts:27](https://github.com/ozum/not-sync/blob/a26c21f/src/main.

`Optional` **addEntry**: _undefined_ \| [_OnAddEntry_](#onaddentry)

Defined in: [index.ts:23](https://github.com/ozum/not-sync/blob/a26c21f/src/index.ts#L23)
Defined in: [index.ts:23](https://github.com/ozum/not-sync/blob/d856cff/src/index.ts#L23)

---

### delete

`Optional` **delete**: _undefined_ \| [_OnDelete_](#ondelete)

Defined in: [index.ts:22](https://github.com/ozum/not-sync/blob/a26c21f/src/index.ts#L22)
Defined in: [index.ts:22](https://github.com/ozum/not-sync/blob/d856cff/src/index.ts#L22)

---

### deleteEntry

`Optional` **deleteEntry**: _undefined_ \| [_OnDeleteEntry_](#ondeleteentry)

Defined in: [index.ts:24](https://github.com/ozum/not-sync/blob/a26c21f/src/index.ts#L24)
Defined in: [index.ts:24](https://github.com/ozum/not-sync/blob/d856cff/src/index.ts#L24)

---

### found

`Optional` **found**: _undefined_ \| [_OnFound_](#onfound)

Defined in: [index.ts:17](https://github.com/ozum/not-sync/blob/a26c21f/src/index.ts#L17)
Defined in: [index.ts:17](https://github.com/ozum/not-sync/blob/d856cff/src/index.ts#L17)

---

### move

`Optional` **move**: _undefined_ \| [_OnMove_](#onmove)

Defined in: [index.ts:19](https://github.com/ozum/not-sync/blob/a26c21f/src/index.ts#L19)
Defined in: [index.ts:19](https://github.com/ozum/not-sync/blob/d856cff/src/index.ts#L19)

---

### moveFail

`Optional` **moveFail**: _undefined_ \| [_OnMoveFail_](#onmovefail)

Defined in: [index.ts:20](https://github.com/ozum/not-sync/blob/a26c21f/src/index.ts#L20)
Defined in: [index.ts:20](https://github.com/ozum/not-sync/blob/d856cff/src/index.ts#L20)

---

### notFound

`Optional` **notFound**: _undefined_ \| [_OnNotFound_](#onnotfound)

Defined in: [index.ts:18](https://github.com/ozum/not-sync/blob/a26c21f/src/index.ts#L18)
Defined in: [index.ts:18](https://github.com/ozum/not-sync/blob/d856cff/src/index.ts#L18)

---

### symlink

`Optional` **symlink**: _undefined_ \| [_OnSymlink_](#onsymlink)

Defined in: [index.ts:21](https://github.com/ozum/not-sync/blob/a26c21f/src/index.ts#L21)
Defined in: [index.ts:21](https://github.com/ozum/not-sync/blob/d856cff/src/index.ts#L21)

<a name="interfacesoptionsmd"></a>

Expand Down Expand Up @@ -427,7 +358,7 @@ Options

Current working directory to be used for resolving relative paths.

Defined in: [index.ts:30](https://github.com/ozum/not-sync/blob/a26c21f/src/index.ts#L30)
Defined in: [index.ts:30](https://github.com/ozum/not-sync/blob/d856cff/src/index.ts#L30)

---

Expand All @@ -437,7 +368,7 @@ Defined in: [index.ts:30](https://github.com/ozum/not-sync/blob/a26c21f/src/inde

Prevents changes to be written to disk. Executes a dry run.

Defined in: [index.ts:34](https://github.com/ozum/not-sync/blob/a26c21f/src/index.ts#L34)
Defined in: [index.ts:34](https://github.com/ozum/not-sync/blob/d856cff/src/index.ts#L34)

---

Expand All @@ -447,7 +378,7 @@ Defined in: [index.ts:34](https://github.com/ozum/not-sync/blob/a26c21f/src/inde

Ignore configuration files (e.g. .gitignore, .prettierignore) to add new created files if any.

Defined in: [index.ts:32](https://github.com/ozum/not-sync/blob/a26c21f/src/index.ts#L32)
Defined in: [index.ts:32](https://github.com/ozum/not-sync/blob/d856cff/src/index.ts#L32)

---

Expand All @@ -457,7 +388,7 @@ Defined in: [index.ts:32](https://github.com/ozum/not-sync/blob/a26c21f/src/inde

Move files near original one for iCloudDrive. For example "node_modules" is moved "node_modules.nosync" in same directory.

Defined in: [index.ts:40](https://github.com/ozum/not-sync/blob/a26c21f/src/index.ts#L40)
Defined in: [index.ts:40](https://github.com/ozum/not-sync/blob/d856cff/src/index.ts#L40)

---

Expand All @@ -467,7 +398,7 @@ Defined in: [index.ts:40](https://github.com/ozum/not-sync/blob/a26c21f/src/inde

Event handler functions to act on several events generated during operation.

Defined in: [index.ts:36](https://github.com/ozum/not-sync/blob/a26c21f/src/index.ts#L36)
Defined in: [index.ts:36](https://github.com/ozum/not-sync/blob/d856cff/src/index.ts#L36)

---

Expand All @@ -477,7 +408,7 @@ Defined in: [index.ts:36](https://github.com/ozum/not-sync/blob/a26c21f/src/inde

Roots of cloud services. If default roots has to be changed for same reson.

Defined in: [index.ts:44](https://github.com/ozum/not-sync/blob/a26c21f/src/index.ts#L44)
Defined in: [index.ts:44](https://github.com/ozum/not-sync/blob/d856cff/src/index.ts#L44)

---

Expand All @@ -487,7 +418,7 @@ Defined in: [index.ts:44](https://github.com/ozum/not-sync/blob/a26c21f/src/inde

Custom roots for each cloud service to move files.

Defined in: [index.ts:42](https://github.com/ozum/not-sync/blob/a26c21f/src/index.ts#L42)
Defined in: [index.ts:42](https://github.com/ozum/not-sync/blob/d856cff/src/index.ts#L42)

---

Expand All @@ -497,4 +428,4 @@ Defined in: [index.ts:42](https://github.com/ozum/not-sync/blob/a26c21f/src/inde

Adds extra information to event handlers.

Defined in: [index.ts:38](https://github.com/ozum/not-sync/blob/a26c21f/src/index.ts#L38)
Defined in: [index.ts:38](https://github.com/ozum/not-sync/blob/d856cff/src/index.ts#L38)

0 comments on commit 9cd0147

Please sign in to comment.