GithubHelp home page GithubHelp logo

kashav / point Goto Github PK

View Code? Open in Web Editor NEW
150.0 3.0 9.0 3.57 MB

Shorten URLs with GitHub repositories and the http-equiv attribute.

License: MIT License

Makefile 15.24% Go 84.76%
golang url-shortener http-equiv refresh

point's Introduction

point

Create and manage shortened URLs with GitHub pages.

point lets you create, view, and manage shortened URLs. All pages are hosted on GitHub Pages and redirection is done with HTML5's http-equiv refresh attribute.

Demo

asciicast

Installation

  • You should have Go installed and configured.

  • Install with Go:

    $ go get -v github.com/kshvmdn/point/...
    $ point --help
  • Or, install directly via source:

    $ git clone https://github.com/kshvmdn/point.git $GOPATH/src/github.com/kshvmdn/point
    $ cd $_
    $ make bootstrap install
    $ point --help

Usage

  • You should export your personal GitHub access token as POINT_ACCESS_TOKEN. You can request one here with the repo and delete_repo permissions.

  • View the help dialogue with the --help flag. View the specific help dialogue for each command by running point [command] --help.

    $ point --help
    usage: point [<flags>] <command> [<args> ...]
    
    Create and manage shortened URLs with GitHub pages.
    
    Flags:
      --help     Show context-sensitive help (also try --help-long and --help-man).
      --verbose  Show detailed output.
      --version  Show application version.
    
    Commands:
      help [<command>...]
        Show help.
    
      create [<flags>] <url>
        Create a new entry.
    
      list
        Print a list of active entries.
    
      remove <repo>...
        Remove one or more entries.
    
  • create

    $ point create --help
    usage: point create [<flags>] <url>
    
    Create a new entry.
    
    Flags:
          --help         Show context-sensitive help (also try --help-long and --help-man).
          --verbose      Show detailed output.
          --version      Show application version.
      -c, --cname=CNAME  Optional CNAME record for this repository.
      -n, --name=NAME    Endpoint for the shortened URL, chosen randomly if empty.
      -p, --private      Make this repository private.
      -s, --subdir       Use a subdirectory in a pre-existing repository, instead of creating a new repository.
      -r, --repo=REPO    A pre-existing repository to be used with the --subdir option (expects `foo/bar` for
                         `https://github.com/foo/bar`). Pushes to the default branch.
    
    Args:
      <url>  The URL to shorten.
    
  • list

    $ point list --help
    usage: point list
    
    Print a list of active entries.
    
    Flags:
      --help     Show context-sensitive help (also try --help-long and --help-man).
      --verbose  Show detailed output.
      --version  Show application version.
    
  • remove

    $ point remove --help
    usage: point remove <repo>...
    
    Remove one or more entries.
    
    Flags:
      --help     Show context-sensitive help (also try --help-long and --help-man).
      --verbose  Show detailed output.
      --version  Show application version.
    
    Args:
      <repo>  List of entries to remove.
    

Contribute

This project is completely open source. Feel free to open an issue or create a pull request.

Before submitting code, please ensure that tests are passing and the linter is happy. The following commands may be of use, refer to the Makefile to see what they do.

$ make bootstrap \
       install
$ make fmt \
       vet \
       lint
$ make test \
       coverage
$ make bootstrap-dist \
       dist

License

point source code is released under the MIT license.

point's People

Contributors

alvinantonius avatar kashav avatar soraxas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

point's Issues

Option to use an organization instead.

Currently the tool uses my own repositories. This has the disatvantage of cluttering the public repository list with 'shortened' urls. This problem could be migitated if it were possible to use an organization to store the shortened urls in instead.

Option to create subdirectories instead

Instead of making new repositories, I think it should be possible to create subdirectories in the main GitHub page repo (e.g. arkon.github.io/haiG89h/index.html).

Refresh local cache for entries

Currently, the point list command displays a list of url redirects from local cache (i.e. entries created by point, stored in state.Log.Entries).

However, it might not be the actual list of urls from github page.

That could either be caused by:

  1. Using point from other computer
  2. Manually changing the repo online
  3. Failed creation online that was not recognised by point (e.g. point thought it created an entry online while the actual Github page did not has that entry)
  4. Trying to create the same shorturl multiple time (see below)

Example

Let say I ran this command multiple time:
$ point create -s -r foo/bar -n shorturl "http://something"
It will succeed the first time and command failed after the first execution, which is okay. (failed because there is nothing to commit in git)
(But ideally it should notify the user that the same entry already exists)


Starting fresh. The problem lies on if I run:
$ point create -s -r foo/bar -n shorturl "http://something"
$ point create -s -r foo/bar -n shorturl "http://somethingelse"
$ point create -s -r foo/bar -n shorturl "http://something"
$ point create -s -r foo/bar -n shorturl "http://somethingelse"
it will succeed everytime because it was able to update the repo successfully, which is okay too.
(Ideally it should notify the user that it has updated an existing entry)
But if I then run point list it will shows:

$ point list
1) foo/bar -> http://something
2) foo/bar -> http://somethingelse
3) foo/bar -> http://something
4) foo/bar -> http://somethingelse

while the actual repo only has one folder named bar/shorturl (i.e. github.com/foo/bar/shorturl). It's because state.Log.Entries has desynced from the actual repo.


A solution might be add an option to sync with the repo, something like

point list -s -r foo/bar --sync

which iterate the folders, looking for some token to know that it's a shorten url, and update its state.Log.Entries accordingly. Which should then show something like:

$ point list -s -r foo/bar --sync
1) foo/bar -> http://somethingelse

and thereafter.

Of course, this is only covering the subdirectory case and I'm not sure how to go about on the createNewRepo case (which would be expensive to loop through all repos)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.