#tool #command-line-tool #api #cosense

app makesense

A tool for interacting with Cosense API

1 unstable release

0.1.0 Oct 5, 2024

#1201 in Network programming

MIT license

26KB
599 lines

Makesense

An unofficial CLI tool for seamless interaction with the Cosense API

InstallationQuick StartDetailed UsageContributingLicense

Installation

Linux & macOS

curl -L https://github.com/kawakamimoeki/makesense/releases/download/v0.1.0/makesense-$(uname -s)-$(uname -m) -o mks
chmod +x mks
sudo mv mks /usr/local/bin/

Windows

Invoke-WebRequest https://github.com/kawakamimoeki/makesense/releases/download/v0.1.0/makesense-windows-amd64.exe -OutFile mks.exe
Move-Item .\mks.exe C:\Windows\System32\

Quick Start

  1. Login to your Cosense account:

    mks login your-connect-sid
    
  2. Fetch JSON data from a project:

    mks json your-project --pretty
    
  3. Search within a project:

    mks search your-project "your search query" --link
    

Detailed Usage

Global Options

All commands support the following global options:

  • --help: Show help information for the command
  • --version: Show the version of Makesense

Login

Authenticate with Cosense using your connect.sid cookie:

mks login <your-connect-sid>

JSON

Retrieve JSON data from a project or page:

mks json <resource> [options]

Options:

  • --pretty or -p: Format the JSON output for better readability
  • --skip <value> or -s <value>: Skip a number of pages (for project JSON)
  • --limit <value> or -l <value>: Limit the number of pages returned (for project JSON)
  • --url or -u: Display the API URL instead of fetching data
  • --query <value> or -q <value>: Specify a search query (for search JSON)

Examples:

mks json my-project --pretty
mks json my-project/my-page --url
mks json my-project --query "search term" --limit 10

Pages

List page titles for a project:

mks pages <project> [options]

Options:

  • --skip <value> or -s <value>: Skip a number of pages
  • --limit <value> or -l <value>: Limit the number of pages returned
  • --url or -u: Display the API URL instead of fetching data
  • --link: Include page links in the output

Example:

mks pages my-project --limit 20 --link

Create

Create a new page with content:

mks create <page> <body> [options]

Options:

  • --url or -u: Display the API URL instead of creating the page

Example:

mks create "My New Page" "This is the content of my new page."

Page

View or open a page:

mks page <page> [options]

Options:

  • --web or -w: Open the page in a web browser
  • --url or -u: Display the API URL instead of fetching the page

Examples:

mks page my-project/my-page
mks page my-project/my-page --web

Code

Retrieve code snippets from a page:

mks code <page> <name> [options]

Options:

  • --url or -u: Display the API URL instead of fetching the code

Example:

mks code my-project/my-page my-code-snippet

Table

Extract table data in CSV format from a page:

mks table <page> <name> [options]

Options:

  • --url or -u: Display the API URL instead of fetching the table

Example:

mks table my-project/my-page my-table-name

Icon

Fetch the icon of a page:

mks icon <page> [options]

Options:

  • --url or -u: Display the API URL instead of fetching the icon

Example:

mks icon my-project/my-page

Search within a project:

mks search <project> <query> [options]

Options:

  • --url or -u: Display the API URL instead of performing the search
  • --link or -l: Include links to the search results

Example:

mks search my-project "important topic" --link

License

Distributed under the MIT License. See LICENSE for more information.

Support

If you encounter any issues or have questions, please open an issue on our GitHub repository.


Made with ❤️ by kawakamimoeki

Dependencies

~8–22MB
~310K SLoC