github.com/hrntknr/ntf@v1.0.2-0.20220725163249-d52a7861d93d/README.md (about)

     1  # ntf
     2  
     3  [![build](https://github.com/hrntknr/ntf/workflows/.github/workflows/build.yml/badge.svg)](https://github.com/hrntknr/ntf/actions?query=workflow%3A.github%2Fworkflows%2Fbuild.yml)
     4  
     5  `ntf` brings notification to your shell. This project was inspired by [ntfy](https://github.com/dschep/ntfy).
     6  
     7  Compared to ntfy, it has the following advantages
     8  
     9  - Works in a single binary
    10  - lightweight
    11  - No need to install additional plug-ins
    12  
    13  However, support for the backend type is poorer than ntfy.
    14  
    15  ## Quickstart
    16  
    17  ```sh
    18  $ # for linux
    19  $ sudo curl -L https://github.com/hrntknr/ntf/releases/download/v1.0.1/ntf-x86_64-unknown-linux-gnu -o /usr/local/bin/ntf
    20  $ # for mac
    21  $ # sudo curl -L https://github.com/hrntknr/ntf/releases/download/v1.0.1/ntf-x86_64-apple-darwin -o /usr/local/bin/ntf
    22  $ sudo chmod +x /usr/local/bin/ntf
    23  
    24  $ echo -e 'backends: ["pushover"]\npushover: {"user_key": "t0k3n"}' > ~/.ntf.yml
    25  $ # If you want to use slack, you can do the following
    26  $ # echo -e 'backends: ["slack"]\nslack: {"webhook: "https://hooks.slack.com/services/hogehoge"}' > ~/.ntf.yml
    27  $
    28  $ # send message: "test"
    29  $ ntf send test
    30  $ # override default setting
    31  $ ntf send test --pushover.priority emergency --pushover.retry 60 --pushover.expire 3000
    32  $
    33  $ # exec command: `sleep 1` and send result
    34  $ ntf done sleep 1
    35  $
    36  $ # Enable shell integration
    37  $ echo 'export AUTO_NTF_DONE_LONGER_THAN=10' >> ~/.bashrc
    38  $ echo 'eval "$(ntf shell-integration)"' >> ~/.bashrc
    39  ```
    40  
    41  ```
    42  > $ ntf --help
    43  Usage:
    44     [command]
    45  
    46  Available Commands:
    47    done              Execute the command and notify the message
    48    help              Help about any command
    49    send              send notification
    50    shell-integration shell-integration
    51  
    52  Flags:
    53    -h, --help   help for this command
    54  
    55  Use " [command] --help" for more information about a command.
    56  
    57  > $ ntf send --help
    58  send notification
    59  
    60  Usage:
    61     send [flags]
    62  
    63  Flags:
    64        --backends strings
    65    -h, --help                       help for send
    66        --line.token string
    67        --pushbullet.token string
    68        --pushover.device string
    69        --pushover.expire int
    70        --pushover.priority string
    71        --pushover.retry int
    72        --pushover.user_key string
    73        --slack.color string
    74        --slack.webhook string
    75        --syslog.facility string
    76        --syslog.severity string
    77    -t, --title string               override title
    78  ```
    79  
    80  ## Supported backend
    81  
    82  ### [slack: (webhook)](https://api.slack.com/messaging/webhooks)
    83  
    84  `~/.ntf.yml` example:
    85  
    86  ```yml
    87  backends:
    88    - slack
    89  slack:
    90    webhook: 'https://hooks.slack.com/services/****'
    91    color: '#ff0000' #option
    92  ```
    93  
    94  ### [discord: (Webhook compatible with slack)](https://discord.com/developers/docs/resources/webhook)
    95  
    96  `~/.ntf.yml` example:
    97  
    98  ```yml
    99  backends:
   100    - slack
   101  slack:
   102    webhook: 'https://discordapp.com/api/webhooks/****/****/slack'
   103    color: '#ff0000' #option
   104  ```
   105  
   106  ### [pushbullet](https://pushbullet.com/)
   107  
   108  `~/.ntf.yml` example:
   109  
   110  ```yml
   111  backends:
   112    - pushbullet
   113  pushbullet:
   114    token: '********************'
   115  ```
   116  
   117  ### [pushover](https://pushover.net/)
   118  
   119  `~/.ntf.yml` example:
   120  
   121  ```yml
   122  backends:
   123    - pushover
   124  pushover:
   125    user_key: '********************'
   126    priority: 'emergency' #option (emergency|high|normal|low|lowest)
   127    retry: 30 #option
   128    expire: 3600 #option
   129  ```
   130  
   131  ### [line](https://notify-bot.line.me/)
   132  
   133  `~/.ntf.yml` example:
   134  
   135  ```yml
   136  backends:
   137    - line
   138  line:
   139    token: '********************'
   140  ```
   141  
   142  ### syslog
   143  
   144  `~/.ntf.yml` example:
   145  
   146  ```yml
   147  backends:
   148    - syslog
   149  syslog:
   150    facility: 'user' #option
   151    severity: 'emerg' #option
   152  ```
   153  
   154  ## Custom backend
   155  
   156  You can add the custom backend you want by simply creating a struct that implements the interface in the backends folder.  
   157  Or, submit a backend request that you would like to use via Issue.