Skip to content

Commit

Permalink
Merge branch 'release/0.3.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
msudgh committed Aug 5, 2024
2 parents 3abf866 + 6485547 commit 04e1745
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 18 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,13 @@ jobs:
unit-tests:
strategy:
matrix:
os: ['ubuntu-latest', 'windows-latest']
node_version: [lts/*]
os:
- 'ubuntu-latest'
- 'windows-latest'
- 'macos-latest'
node_version:
- '>=18.0.0'
- 'lts/*'
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
Expand Down
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ ovm (Obsidian Vaults Manager) is a CLI application designed to streamline the ma
## Features

- **Manage Obsidian plugins**: Install/Uninstall/Prune plugins in multiple vaults at one go.
- **Perform actions on Obsidian or custom vaults**: By default, Obsidian vaults are supported and detected. The vaults related commands support `-p` flag to define a custom vault/s from a path or [`Glob`](<https://en.wikipedia.org/wiki/Glob_(programming)>) pattern. e.g. `~/Documents/obsidian/*`.
- **Generate reports**: Generate stats of vaults and installed plugins with Table/JSON format.
- **Interactive CLI**: User-friendly interface to select vaults and plugins for each command.
- **Cross-platform**: Windows, macOS, and Linux.
Expand All @@ -43,6 +44,14 @@ USAGE
...
```

**Common flags**

```bash
-c, --config=<value> [default: ~/ovm.json] Path to the config file.
-d, --debug Enable debugging mode.
-t, --timestamp Enable timestamp in logs.
```

## Config file

The config file is created in the user's home directory and is named `ovm.json` by [`ovm ci`](#ovm-config-init--ovm-ci). It contains an array of plugins that are to be installed across single/multiple vault.
Expand Down Expand Up @@ -141,7 +150,7 @@ info: Pruned 1 plugins {"vault":{"name":"Test","path":"~/Documents/obsidian/Test

### `ovm plugins uninstall` / `ovm pu`

Uninstall plugins from specified vaults.
Uninstall plugin/s from vaults.

- _Usage:_ `ovm help plugins uninstall`
- _See code:_ [src/commands/plugins/uninstall.ts](src/commands/plugins/uninstall.ts)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "ovm",
"description": "Obsidian Vaults Manager",
"type": "commonjs",
"version": "0.3.0",
"version": "0.3.1",
"license": "MIT",
"author": "Masoud Ghorbani",
"homepage": "https://github.com/msudgh/ovm",
Expand Down
4 changes: 2 additions & 2 deletions src/commands/plugins/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
} from '../../providers/github'
import { modifyCommunityPlugins } from '../../services/plugins'
import { vaultsSelector } from '../../services/vaults'
import { VAULTS_PATH_FLAG_DESCRIPTION } from '../../utils/constants'
import { PluginNotFoundInRegistryError } from '../../utils/errors'
import { logger } from '../../utils/logger'

Expand Down Expand Up @@ -45,8 +46,7 @@ export default class Install extends FactoryCommand {
static override readonly flags = {
path: Flags.string({
char: 'p',
description:
'Path or Glob pattern of vaults to install plugins. (default: detects vaults from Obsidian configuration)',
description: VAULTS_PATH_FLAG_DESCRIPTION,
default: '',
}),
enable: Flags.boolean({
Expand Down
4 changes: 2 additions & 2 deletions src/commands/plugins/prune.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import FactoryCommand, { FactoryFlags } from '../../providers/command'
import { Config, safeLoadConfig } from '../../providers/config'
import { listInstalledPlugins, removePluginDir } from '../../services/plugins'
import { vaultsSelector } from '../../services/vaults'
import { VAULTS_PATH_FLAG_DESCRIPTION } from '../../utils/constants'
import { logger } from '../../utils/logger'

interface PruneFlags {
Expand All @@ -31,8 +32,7 @@ export default class Prune extends FactoryCommand {
static override readonly flags = {
path: Flags.string({
char: 'p',
description:
'Path or Glob pattern of vaults to prune plugins. Default: reads from Obsidian config per environment.',
description: VAULTS_PATH_FLAG_DESCRIPTION,
default: '',
}),
...this.commonFlags,
Expand Down
6 changes: 3 additions & 3 deletions src/commands/plugins/uninstall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import FactoryCommand, { FactoryFlags } from '../../providers/command'
import { Config, Plugin, safeLoadConfig } from '../../providers/config'
import { pluginsSelector, removePluginDir } from '../../services/plugins'
import { vaultsSelector } from '../../services/vaults'
import { VAULTS_PATH_FLAG_DESCRIPTION } from '../../utils/constants'
import { logger } from '../../utils/logger'

interface UninstallArgs {
Expand All @@ -25,7 +26,7 @@ interface UninstallPluginVaultOpts {
*/
export default class Uninstall extends FactoryCommand {
static readonly aliases = ['pu', 'plugins:uninstall']
static override readonly description = `Uninstall plugin/s from specified vaults.`
static override readonly description = `Uninstall plugin/s from vaults.`
static override readonly examples = [
'<%= config.bin %> <%= command.id %> --path=/path/to/vaults',
'<%= config.bin %> <%= command.id %> --path=/path/to/vaults/*/.obsidian',
Expand All @@ -35,8 +36,7 @@ export default class Uninstall extends FactoryCommand {
static override readonly flags = {
path: Flags.string({
char: 'p',
description:
'Path or Glob pattern of vaults to uninstall plugins. Default: reads from Obsidian config per environment.',
description: VAULTS_PATH_FLAG_DESCRIPTION,
default: '',
}),
...this.commonFlags,
Expand Down
4 changes: 2 additions & 2 deletions src/commands/reports/stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import FactoryCommand, { FactoryFlags } from '../../providers/command'
import { Config, safeLoadConfig } from '../../providers/config'
import { InstalledPlugins } from '../../services/plugins'
import { vaultsSelector } from '../../services/vaults'
import { VAULTS_PATH_FLAG_DESCRIPTION } from '../../utils/constants'
import { logger } from '../../utils/logger'
interface StatsFlags {
path: string
Expand All @@ -33,8 +34,7 @@ export default class Stats extends FactoryCommand {
static override readonly flags = {
path: Flags.string({
char: 'p',
description:
'Path or Glob pattern of vaults to get stats from. Default: reads from Obsidian per vault config per environment.',
description: VAULTS_PATH_FLAG_DESCRIPTION,
default: '',
}),
output: Flags.string({
Expand Down
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export { run } from '@oclif/core'
export * from './commands/config/init'
export * from './commands/plugins/install'
export * from './commands/plugins/prune'
export * from './commands/plugins/uninstall'
export * from './commands/reports/stats'
8 changes: 4 additions & 4 deletions src/providers/command.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { ExitPromptError } from '@inquirer/core'
import { Command, Flags, handle } from '@oclif/core'
import { Vault } from 'obsidian-utils'
import { DEFAULT_CONFIG_PATH } from '../constants'
import {
findVaultsByPatternMatching,
findVaultsFromConfig,
} from '../services/vaults'
import { DEFAULT_CONFIG_PATH } from '../utils/constants'
import { logger } from '../utils/logger'

export type CommonFlags = {
Expand All @@ -21,16 +21,16 @@ export default class FactoryCommand extends Command {
debug: Flags.boolean({
char: 'd',
default: false,
description: 'Enable debugging mode',
description: 'Enable debugging mode.',
}),
timestamp: Flags.boolean({
char: 't',
default: false,
description: 'Enable timestamp in logs',
description: 'Enable timestamp in logs.',
}),
config: Flags.file({
char: 'c',
description: `Path to the configuration file. (default: ${DEFAULT_CONFIG_PATH})`,
description: `Path to the config file.`,
default: DEFAULT_CONFIG_PATH,
required: false,
}),
Expand Down
2 changes: 1 addition & 1 deletion src/providers/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ConfigSchema, safeLoadConfig } from './config'

import { expect } from 'chai'
import mock from 'mock-fs'
import { OVM_CONFIG_FILENAME } from '../constants'
import { OVM_CONFIG_FILENAME } from '../utils/constants'

describe('Config', () => {
it("should load config from user's home dir", async () => {
Expand Down
2 changes: 2 additions & 0 deletions src/constants.ts → src/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ import path from 'path'

export const OVM_CONFIG_FILENAME = 'ovm.json'
export const DEFAULT_CONFIG_PATH = path.join(homedir(), OVM_CONFIG_FILENAME)
export const VAULTS_PATH_FLAG_DESCRIPTION =
'[default: detect from Obsidian config] Path or Glob pattern of vaults to install plugins.'

0 comments on commit 04e1745

Please sign in to comment.