Skip to content

Commit

Permalink
feat: add readme for clipboard
Browse files Browse the repository at this point in the history
  • Loading branch information
Mussabaheen committed Mar 25, 2024
1 parent 7689666 commit ec8c16b
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 1 deletion.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) [2024] [Mussabeheen]

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.
51 changes: 51 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@

# MacOS ClipBoard

App to maintain the clipboard history for MacOS

## Run Locally

Clone the project

```bash
git clone https://github.com/Mussabaheen/clipboard
```

Go to the project directory

```bash
cd clipboard
```

Install dependencies

```bash
go mod tidy
```

Start the clipboard server

```bash
go run main.go
```

## Configurable arguments
### PORT
port on which you want to serve your clipboard UI
```
--port
```

## Authors

- [@mussabeheen-malik](https://www.linkedin.com/in/mussabaheen-malik/)


## Contributing

Contributions are always welcome!

There is always room for improvements feel free to create issues or pull requests.

If you have any questions feel free to email at mussabaheen@gmail.com

10 changes: 9 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"context"
"encoding/json"
"flag"
"fmt"
"net/http"
"path"
Expand All @@ -14,7 +15,14 @@ import (
var data []string
var clients = make(map[chan []byte]struct{})

var (
localPortUsage = "Specify the port number on which you want to serve the UI, by default 8080"
)

func main() {
// localPort represents the arg with flag -p
localPort := flag.String("port", "8080", localPortUsage)
flag.Parse()
err := clipboard.Init()
if err != nil {
panic(err)
Expand All @@ -25,7 +33,7 @@ func main() {

http.HandleFunc("/", ShowClipboard)
http.HandleFunc("/updates", UpdatesHandler)
err = http.ListenAndServe(":8080", nil)
err = http.ListenAndServe(":"+*localPort, nil)
if err != nil {
panic("error occured while running clipboard : " + err.Error())
}
Expand Down

0 comments on commit ec8c16b

Please sign in to comment.