Repository: sindresorhus/do-not-disturb-cli
Branch: main
Commit: 7c36c3caa820
Files: 11
Total size: 4.1 KB
Directory structure:
gitextract_rpl3d0o7/
├── .editorconfig
├── .gitattributes
├── .github/
│ └── workflows/
│ └── main.yml
├── .gitignore
├── .npmrc
├── cli.js
├── dnd.js
├── license
├── package.json
├── readme.md
└── test.js
================================================
FILE CONTENTS
================================================
================================================
FILE: .editorconfig
================================================
root = true
[*]
indent_style = tab
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.yml]
indent_style = space
indent_size = 2
================================================
FILE: .gitattributes
================================================
* text=auto eol=lf
================================================
FILE: .github/workflows/main.yml
================================================
name: CI
on:
- push
- pull_request
jobs:
test:
name: Node.js ${{ matrix.node-version }}
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
node-version:
- 16
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm test
================================================
FILE: .gitignore
================================================
node_modules
yarn.lock
================================================
FILE: .npmrc
================================================
package-lock=false
================================================
FILE: cli.js
================================================
#!/usr/bin/env node
import meow from 'meow';
import doNotDisturb from '@sindresorhus/do-not-disturb';
const cli = meow(`
Usage
$ do-not-disturb <command>
Commands
on
off
toggle
status
Examples
$ do-not-disturb on
$ do-not-disturb status
on
Use \`$ dnd\` to quickly toggle
`, {
importMeta: import.meta,
});
const [command] = cli.input;
(async () => {
switch (command) {
case 'on':
await doNotDisturb.enable();
break;
case 'off':
await doNotDisturb.disable();
break;
case 'toggle':
await doNotDisturb.toggle();
break;
case 'status':
console.log(await doNotDisturb.isEnabled() ? 'on' : 'off');
break;
default:
cli.showHelp();
}
})();
================================================
FILE: dnd.js
================================================
#!/usr/bin/env node
import meow from 'meow';
import doNotDisturb from '@sindresorhus/do-not-disturb';
meow(`
Usage
$ dnd
Toggle "Do Not Disturb"
`, {
importMeta: import.meta,
});
doNotDisturb.toggle();
================================================
FILE: license
================================================
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
================================================
FILE: package.json
================================================
{
"name": "do-not-disturb-cli",
"version": "1.0.0",
"description": "Control the macOS `Do Not Disturb` feature from the command-line",
"license": "MIT",
"repository": "sindresorhus/do-not-disturb-cli",
"funding": "https://github.com/sponsors/sindresorhus",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "https://sindresorhus.com"
},
"type": "module",
"bin": {
"do-not-disturb": "./cli.js",
"dnd": "./dnd.js"
},
"engines": {
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"cli.js",
"dnd.js"
],
"keywords": [
"cli-app",
"cli",
"macos",
"swift",
"notifications"
],
"dependencies": {
"@sindresorhus/do-not-disturb": "^2.0.0",
"meow": "^10.1.1"
},
"devDependencies": {
"ava": "^3.15.0",
"execa": "^5.1.1",
"xo": "^0.45.0"
}
}
================================================
FILE: readme.md
================================================
# do-not-disturb-cli
> Control the macOS `Do Not Disturb` feature from the command-line
## Install
```sh
npm install --global do-not-disturb-cli
```
## Usage
```
$ do-not-disturb --help
Usage
$ do-not-disturb <command>
Commands
on
off
toggle
status
Examples
$ do-not-disturb on
$ do-not-disturb status
on
Use `$ dnd` to quickly toggle
```
## Related
- [do-not-disturb](https://github.com/sindresorhus/do-not-disturb) - API for this module
================================================
FILE: test.js
================================================
import test from 'ava';
import execa from 'execa';
test('main', async t => {
const {stdout} = await execa('./cli.js', ['status']);
t.regex(stdout, /on|off/);
});
gitextract_rpl3d0o7/ ├── .editorconfig ├── .gitattributes ├── .github/ │ └── workflows/ │ └── main.yml ├── .gitignore ├── .npmrc ├── cli.js ├── dnd.js ├── license ├── package.json ├── readme.md └── test.js
Condensed preview — 11 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (5K chars).
[
{
"path": ".editorconfig",
"chars": 175,
"preview": "root = true\n\n[*]\nindent_style = tab\nend_of_line = lf\ncharset = utf-8\ntrim_trailing_whitespace = true\ninsert_final_newlin"
},
{
"path": ".gitattributes",
"chars": 19,
"preview": "* text=auto eol=lf\n"
},
{
"path": ".github/workflows/main.yml",
"chars": 405,
"preview": "name: CI\non:\n - push\n - pull_request\njobs:\n test:\n name: Node.js ${{ matrix.node-version }}\n runs-on: macos-lat"
},
{
"path": ".gitignore",
"chars": 23,
"preview": "node_modules\nyarn.lock\n"
},
{
"path": ".npmrc",
"chars": 19,
"preview": "package-lock=false\n"
},
{
"path": "cli.js",
"chars": 706,
"preview": "#!/usr/bin/env node\nimport meow from 'meow';\nimport doNotDisturb from '@sindresorhus/do-not-disturb';\n\nconst cli = meow("
},
{
"path": "dnd.js",
"chars": 211,
"preview": "#!/usr/bin/env node\nimport meow from 'meow';\nimport doNotDisturb from '@sindresorhus/do-not-disturb';\n\nmeow(`\n\tUsage\n\t "
},
{
"path": "license",
"chars": 1117,
"preview": "MIT License\n\nCopyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)\n\nPermission is hereby grant"
},
{
"path": "package.json",
"chars": 861,
"preview": "{\n\t\"name\": \"do-not-disturb-cli\",\n\t\"version\": \"1.0.0\",\n\t\"description\": \"Control the macOS `Do Not Disturb` feature from t"
},
{
"path": "readme.md",
"chars": 490,
"preview": "# do-not-disturb-cli\n\n> Control the macOS `Do Not Disturb` feature from the command-line\n\n## Install\n\n```sh\nnpm install "
},
{
"path": "test.js",
"chars": 165,
"preview": "import test from 'ava';\nimport execa from 'execa';\n\ntest('main', async t => {\n\tconst {stdout} = await execa('./cli.js', "
}
]
About this extraction
This page contains the full source code of the sindresorhus/do-not-disturb-cli GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 11 files (4.1 KB), approximately 1.5k tokens. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.