smallhadroncollider / Brok

Licence: other
Find broken links in text documents

Programming Languages

haskell
3896 projects

Projects that are alternatives of or similar to Brok

Sad
CLI search and replace | Space Age seD
Stars: ✭ 350 (-10.94%)
Mutual labels:  command-line
T2b
A wicked-powerful text macro language for building binary files.
Stars: ✭ 370 (-5.85%)
Mutual labels:  command-line
Func
Modern Command Line Framework.
Stars: ✭ 384 (-2.29%)
Mutual labels:  command-line
Reminders Cli
A simple CLI for interacting with macOS reminders
Stars: ✭ 354 (-9.92%)
Mutual labels:  command-line
Terminal Link
Create clickable links in the terminal
Stars: ✭ 361 (-8.14%)
Mutual labels:  command-line
Command Line One Liners
Command line one-liners.
Stars: ✭ 372 (-5.34%)
Mutual labels:  command-line
Gulp Cli
Command Line Interface for gulp.
Stars: ✭ 347 (-11.7%)
Mutual labels:  command-line
Beats
A command-line drum machine. Convert a beat notated in YAML into a *.wav file.
Stars: ✭ 389 (-1.02%)
Mutual labels:  command-line
Jwt Cracker
Simple HS256 JWT token brute force cracker
Stars: ✭ 365 (-7.12%)
Mutual labels:  command-line
Py cui
A python library for intuitively creating CUI/TUI interfaces with widgets, inspired by gocui.
Stars: ✭ 380 (-3.31%)
Mutual labels:  command-line
Tsukae
🧑‍💻📊 Show off your most used shell commands
Stars: ✭ 345 (-12.21%)
Mutual labels:  command-line
Bulksplash
A simple command line tool that lets you bulk download images from Unsplash
Stars: ✭ 362 (-7.89%)
Mutual labels:  command-line
Castero
TUI podcast client for the terminal
Stars: ✭ 375 (-4.58%)
Mutual labels:  command-line
Facebook Cli
💻 Facebook command line tool
Stars: ✭ 350 (-10.94%)
Mutual labels:  command-line
Clamp
a Ruby command-line application framework
Stars: ✭ 387 (-1.53%)
Mutual labels:  command-line
Gandi.cli
command line interface to Gandi.net products using the public API
Stars: ✭ 349 (-11.2%)
Mutual labels:  command-line
Kondo
Save disk space by cleaning non-essential files from software projects.
Stars: ✭ 373 (-5.09%)
Mutual labels:  command-line
Pipupgrade
🗽 Like yarn outdated/upgrade, but for pip. Upgrade all your pip packages and automate your Python Dependency Management.
Stars: ✭ 391 (-0.51%)
Mutual labels:  command-line
Jmxterm
Interactive command line JMX client
Stars: ✭ 389 (-1.02%)
Mutual labels:  command-line
Linux command line
💻 Introduction to Linux commands and Shell scripting
Stars: ✭ 378 (-3.82%)
Mutual labels:  command-line

brök

Find broken links in text documents

Demo

Similar idea to awesome_bot, but with different output options.

Currently only supports http:// and https:// prefixed URLs

Install

Binaries for Mac and Linux are available. Add the binary to a directory in your path (such as /usr/local/bin).

Docker

To build the latest version:

docker build -t brok https://github.com/smallhadroncollider/brok.git

To run brök:

docker run brok

Cabal

If you have cabal installed:

cabal install brok

Make sure you run cabal update if you haven't run it recently.

Building

Requirements: Stack

The following command will build brök and then install it in ~/.local/bin:

stack build && stack install

Usage

Basic Usage

Check all links in a single text file:

brok test.md

Or in multiple files:

brok test.md links.tex

If you're using this as part of a test suite, you probably only need the errors:

brok text.md links.tex > /dev/null

Options

Cache

By default brök will cache successes for a day in a .brokdb file. It will always recheck errors.

If you want to adjust the cache length, you can enter the number of seconds after which the cache invalidates:

# cache for a week
brok --cache 604800 test.md links.tex

If you want to avoid creating the .brokdb file or ignore the cache entirely you can use the --no-cache option:

# do not cache results
# and don't use previously generated cache
brok --no-cache test.md links.tex

Check Certificates

Most browsers will display a website even if it has certificate issues (such as an incomplete certificate chain). By default Brök will not check certificates, so replicate this behaviour.

If you would like to enforce certificate checking, you can turn this on:

brok --check-certs test.md

Any sites with certificate issues will then return a Could not connect error.

Ignore URLs

You can tell brök to ignore URLs with specified prefixes:

# ignore facebook and amazon URLS
brok --ignore "http://facebook.com" "http://amazon.com" test.md links.tex

Interval

By default brök waits for 100ms between URL checks. You can change the delay:

# wait for 1 second between checks
brok --interval 1000 test.md links.tex

Only Show Failures

If you want to see what's going on, but you're not interested in successes, then you can use the --only-failures option:

# see what's going on, but only show failures
brok --only-failures test.md links.tex

If you're using brök as part of a script then you should redirect stdout.

Colour Output

By default the output uses bash colour codes. You can turn this off using the --no-color setting.

Git Pre-Commit Hook

If you want to check all the links in your Git repo are valid before being able to commit then add something like the following to .git/hooks/pre-commit.

bash

#! /bin/bash

# cache for 1 week
# use find to check all *.md files
# only show errors (if there are any)
brok --cache 604800 $(find . -type f -name "*.md") > /dev/null

zsh

#! /bin/zsh

# cache for 1 week
# using a zsh glob to check all *.md files
# only show errors (if there are any)
brok --cache 604800 */**/*.md > /dev/null
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].