Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d052e1a995 | ||
|
|
0099fed6e6 | ||
|
|
c444a621b1 | ||
|
|
bb262495b1 |
@ -1,13 +1,23 @@
|
|||||||
#!/usr/bin/env fish
|
#!/usr/bin/env fish
|
||||||
|
|
||||||
function serra_add ()
|
function serra_add ()
|
||||||
|
|
||||||
|
# split input args
|
||||||
set -l args (string split " " $argv)
|
set -l args (string split " " $argv)
|
||||||
|
|
||||||
|
# check if user wants to exit
|
||||||
|
if [ "$args[2]" = "exit" ]
|
||||||
|
exit 0
|
||||||
|
end
|
||||||
|
|
||||||
|
# if usage contains a number at the end, add multiple ones
|
||||||
|
# if not, add a single one
|
||||||
if test -n "$args[3]"
|
if test -n "$args[3]"
|
||||||
./serra add $args[1]/$args[2] --count=$args[3]
|
serra add $args[1]/$args[2] --count=$args[3] -u
|
||||||
echo ./serra add $args[1]/$args[2] --count=$args[3] >> add.log
|
echo serra add $args[1]/$args[2] --count=$args[3] >> add.log
|
||||||
else
|
else
|
||||||
./serra add $args[1]/$args[2]
|
serra add $args[1]/$args[2] -u
|
||||||
echo ./serra add $args[1]/$args[2] >> add.log
|
echo serra add $args[1]/$args[2] >> add.log
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
51
demo.tape
Normal file
51
demo.tape
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
# VHS documentation
|
||||||
|
#
|
||||||
|
# Output:
|
||||||
|
# Output <path>.gif Create a GIF output at the given <path>
|
||||||
|
# Output <path>.mp4 Create an MP4 output at the given <path>
|
||||||
|
# Output <path>.webm Create a WebM output at the given <path>
|
||||||
|
#
|
||||||
|
# Settings:
|
||||||
|
# Set FontSize <number> Set the font size of the terminal
|
||||||
|
# Set FontFamily <string> Set the font family of the terminal
|
||||||
|
# Set Height <number> Set the height of the terminal
|
||||||
|
# Set Width <number> Set the width of the terminal
|
||||||
|
# Set LetterSpacing <float> Set the font letter spacing (tracking)
|
||||||
|
# Set LineHeight <float> Set the font line height
|
||||||
|
# Set Theme <string> Set the theme of the terminal (JSON)
|
||||||
|
# Set Padding <number> Set the padding of the terminal
|
||||||
|
# Set Framerate <number> Set the framerate of the recording
|
||||||
|
# Set PlaybackSpeed <float> Set the playback speed of the recording
|
||||||
|
#
|
||||||
|
# Sleep:
|
||||||
|
# Sleep <time> Sleep for a set amount of <time> in seconds
|
||||||
|
#
|
||||||
|
# Type:
|
||||||
|
# Type[@<time>] "<characters>" Type <characters> into the terminal with a
|
||||||
|
# <time> delay between each character
|
||||||
|
#
|
||||||
|
# Keys:
|
||||||
|
# Backspace[@<time>] [number] Press the Backspace key
|
||||||
|
# Down[@<time>] [number] Press the Down key
|
||||||
|
# Enter[@<time>] [number] Press the Enter key
|
||||||
|
# Space[@<time>] [number] Press the Space key
|
||||||
|
# Tab[@<time>] [number] Press the Tab key
|
||||||
|
# Left[@<time>] [number] Press the Left Arrow key
|
||||||
|
# Right[@<time>] [number] Press the Right Arrow key
|
||||||
|
# Up[@<time>] [number] Press the Up Arrow key
|
||||||
|
# Down[@<time>] [number] Press the Down Arrow key
|
||||||
|
# Ctrl+<key> Press the Control key + <key> (e.g. Ctrl+C)
|
||||||
|
#
|
||||||
|
# Display:
|
||||||
|
# Hide Hide the subsequent commands from the output
|
||||||
|
# Show Show the subsequent commands in the output
|
||||||
|
|
||||||
|
Output demo.gif
|
||||||
|
|
||||||
|
Set FontSize 32
|
||||||
|
Set Width 1200
|
||||||
|
Set Height 600
|
||||||
|
|
||||||
|
Type "serra --version" Sleep 500ms Enter
|
||||||
|
|
||||||
|
Sleep 5s
|
||||||
@ -9,6 +9,7 @@ import (
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
addCmd.Flags().Int64VarP(&count, "count", "c", 1, "Amount of cards to add")
|
addCmd.Flags().Int64VarP(&count, "count", "c", 1, "Amount of cards to add")
|
||||||
|
addCmd.Flags().BoolVarP(&unique, "unique", "u", false, "Only add card if not existent yet")
|
||||||
rootCmd.AddCommand(addCmd)
|
rootCmd.AddCommand(addCmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,6 +40,12 @@ var addCmd = &cobra.Command{
|
|||||||
|
|
||||||
// If duplicate key, increase count of card
|
// If duplicate key, increase count of card
|
||||||
if mongo.IsDuplicateKeyError(err) {
|
if mongo.IsDuplicateKeyError(err) {
|
||||||
|
|
||||||
|
if unique {
|
||||||
|
LogMessage(fmt.Sprintf("Not adding \"%s\" to Collection because it already exists.", c.Name), "red")
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
modify_count_of_card(coll, c, count)
|
modify_count_of_card(coll, c, count)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,6 +13,7 @@ var limit float64
|
|||||||
var name string
|
var name string
|
||||||
var since string
|
var since string
|
||||||
var rarity, set, sort string
|
var rarity, set, sort string
|
||||||
|
var unique bool
|
||||||
|
|
||||||
var rootCmd = &cobra.Command{
|
var rootCmd = &cobra.Command{
|
||||||
Version: Version,
|
Version: Version,
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import (
|
|||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||||
@ -156,6 +157,12 @@ type Set struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func fetch_card(path string) (*Card, error) {
|
func fetch_card(path string) (*Card, error) {
|
||||||
|
|
||||||
|
if !strings.Contains(path, "/") {
|
||||||
|
err := errors.New(fmt.Sprintf("Card must follow format <set>/<number>, for example: ath/15"))
|
||||||
|
return &Card{}, err
|
||||||
|
}
|
||||||
|
|
||||||
// TODO better URL Building...
|
// TODO better URL Building...
|
||||||
resp, err := http.Get(fmt.Sprintf("https://api.scryfall.com/cards/%s/", path))
|
resp, err := http.Get(fmt.Sprintf("https://api.scryfall.com/cards/%s/", path))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user