Skip to content

Commit a26a2d0

Browse files
authored
Merge pull request #2 from function-artisans/simple-cli
Replace the Raycast extension with a CLI
2 parents e733d3d + 90c3f9e commit a26a2d0

33 files changed

Lines changed: 1213 additions & 1849 deletions

‎.github/workflows/ci.yml‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@ jobs:
3030
- name: Install dependencies
3131
run: npm ci
3232

33-
- name: Run ESLint
34-
run: npm run eslint
35-
3633
- name: Run lint
3734
run: npm run lint
3835

‎.gitignore‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@
33
# dependencies
44
/node_modules
55

6-
# Raycast specific files
7-
raycast-env.d.ts
6+
# build output
7+
/dist
88

99
# misc
1010
.DS_Store
11+
12+
# devenv
13+
.devenv
14+
.devenv.flake.nix

‎README.md‎

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,48 @@
11
# format-code
22

3-
Formats source code of various languages from your clipboard and copies that back to the clipboard in the formatted way.
3+
Formats source code from stdin and writes the formatted code to stdout.
4+
5+
## Install
6+
7+
```sh
8+
npm install
9+
npm run build
10+
npm link
11+
```
12+
13+
## Usage
14+
15+
```sh
16+
format-code <language> [--print-width=100] [--sql-dialect=sql] < input
17+
```
18+
19+
Languages: `angular`, `css`, `glimmer`, `graphql`, `html`, `javascript`, `json`,
20+
`json5`, `less`, `lwc`, `markdown`, `mdx`, `scss`, `typescript`, `vue`, `yaml`,
21+
`sql`, `sql-output`.
22+
23+
The `sql-output` language formats a SQL query and its result as two Markdown code
24+
blocks.
25+
26+
To format the code on the macOS clipboard, run:
27+
28+
```sh
29+
pbpaste | format-code json | pbcopy
30+
```
31+
32+
## macOS shortcuts
33+
34+
To generate a signed shortcut for each language, run:
35+
36+
```sh
37+
format-code shortcuts --sql-dialect postgresql
38+
```
39+
40+
Each shortcut formats the code on the clipboard and copies the result back to the
41+
clipboard. The command writes the files to the current directory. To import a
42+
shortcut, open its file:
43+
44+
```sh
45+
open "Format JSON.shortcut"
46+
```
47+
48+
To see all the options, run `format-code shortcuts --help`.

‎assets/icon.png‎

-56.9 KB
Binary file not shown.

‎eslint.config.mjs‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// @ts-check
2+
3+
import js from '@eslint/js';
4+
import { defineConfig } from 'eslint/config';
5+
import tseslint from 'typescript-eslint';
6+
7+
export default defineConfig(
8+
js.configs.recommended,
9+
tseslint.configs.recommended,
10+
);

0 commit comments

Comments
 (0)