You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.MD
+23-28Lines changed: 23 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,31 +39,38 @@ etc, etc, etc.
39
39
All flights are defined in `extension/flights.ts`.
40
40
41
41
## Logical Flights
42
-
Logical flights are, I guess you could call, "smart links".
43
-
They arent hardcoded into this repository and use logic to determine where you want to go.
44
-
You can set defaults for anything within a logical flight.
42
+
Logical flights are smarter than a standard flight because you can set defaults for any variable of the flight.
45
43
44
+
Defaults can be set/unset via:
45
+
-`fly set {key} {value}`
46
+
-`fly unset {key}`
47
+
48
+
### How it works
46
49
Look at the `gh` logical flight as an example. Its logic is as follows: `https://github.com/${gh-org}/${repo}`.
47
50
48
51
If no defaults are specified, the extension will assume you will pass in at least 2 parameters to the flight.
49
-
`fly hg Apollorion manifests.io` is calculated positionally in this case. `Apollorion` will replace `${gh-org}` and `manifests.io` will replace `${repo}`.
52
+
`fly gh Apollorion manifests.io` is calculated positionally. `Apollorion` (the first parameter) will replace `${gh-org}` (the first variable)
53
+
and `manifests.io` (the second parameter) will replace `${repo}` (the second variable).
50
54
Which will fly to `https://github.com/Apollorion/manifests.io`.
51
55
52
-
You can, optionally, set a default for any parameter in a logical flight.
53
-
`fly set gh-org Apollorion` will set the default for `gh-org` to `Apollorion`.
54
-
Now, when you fly the `gh` flight, it will first replace `${gh-org}` with `Apollorion` and then any remaining parameters will be replaced positionally.
56
+
You can, optionally, set a default for any variable in a logical flight.
57
+
`fly set gh-org Apollorion` will set the default for `gh-org` to `Apollorion`.
58
+
Now, when you fly the `gh` flight, it will first replace `${gh-org}` with `Apollorion` and then any remaining parameters will be replaced positionally, like above.
55
59
So you could do `fly gh manifests.io` and it will fly to `https://github.com/Apollorion/manifests.io`.
56
60
57
61
Note: ANY unset parameters will be replaced positionally, in order.
58
62
If you have a logical flight that is defined as `https://my.com/{$thing1}/{$thing2}/{$thing3}`, and you only set the default for `thing1`.
59
-
The extension will expect you to pass in 2 parameters at flight time, otherwise a default flight will be used or an error will be thrown.
63
+
The extension will expect you to pass in 2 parameters at flight time, otherwise a default flight will be used or an error will be thrown.
60
64
`fly my.com test1 test2` will fly to `https://my.com/{thing1 default}/test1/test2/`.
61
65
`fly my.com test` will either go to a defined default flight or throw an error.
62
66
63
67
# Custom flight repos
64
68
You can host a custom flight repo and point the extension to it. This will allow you to define standard and logical flights without contributing to this project.
65
69
66
-
An example repo doc is here: `https://apollorion.com/flight_repo_named.json`
70
+
Repos can be managed via:
71
+
-`fly repo set {name} {url}`
72
+
-`fly repo unset {name}`
73
+
-`fly repo update` - this is what actually fetch's flight data. Akin to `apt update`.
67
74
68
75
The custom flight repo has 2 requirements.
69
76
1. The `Access-Control-Allow-Origin: *` header is present (this is a chrome requirement)
@@ -82,34 +89,22 @@ interface CustomFlightRepo {
82
89
}
83
90
}
84
91
```
85
-
86
-
To use the custom flight repo, just run `fly repo set $name $url` then `fly repo update`. You can unset this repo at anytime via `fly repo unset $name`.
87
-
`fly repo update` will fetch the contents of the repository.
92
+
An example repo doc is here: `https://apollorion.com/flight_repo_named.json`
88
93
89
94
ex:
90
95
1.`fly repo set apollorion https://apollorion.com/flight_repo_named.json`
91
96
2.`fly repo update`
97
+
3.`fly repo unset apollorion`
98
+
99
+
Note: Logical flights take precedence over standard flights, in a custom flight repo. If a flight is defined in this extension as a logical flight, and you want to simplify it, you will want to
100
+
define it as a logical flight in your repo. Otherwise, your flight will not work.
92
101
93
102
# Devving this repo
94
103
95
104
Startup the dev server via `./dev.sh`.
96
105
You need to `load unpacked` the extension in the `extension/dist` dir after building at least once.
97
106
98
-
I havent found a work around yet, but whenever you make a change you need to refresh the extension in `chrome://extensions`.
99
-
100
-
101
-
## Logical Flights
102
-
Say a users query is `fly gh Apollorion manifests.io`
103
-
104
-
The example logic above will match `gh`, split `Apollorion manifests.io` into `$1` = `Apollorion` and `$2` = `manifests.io`.
105
-
The logic defined in `extension/flights.ts` for `gh` is `https://github.com/$1/$2` which resolves to `https://github.com/Apollorion/manifests.io`.
106
-
107
-
If your logical flight doesnt need to be very smart you can simply add the flight name (`gh` in the above example) to the`logicalFlights` const in `extension/main.ts`.
108
-
The extension will "just work" if you expect users to always type the full query in the extension.
109
-
As an example, the `aws` flight automatically builds the correct query without any special logic because it expects the user to type the full query every time.
110
-
111
-
If you logical flight does need some custom logic, you can build that into `extension/main.ts`. I'd suggest using `gh` as an example.
112
-
107
+
I haven't found a work around yet, but whenever you make a change you need to refresh the extension in `chrome://extensions`.
113
108
114
109
# Alfred
115
-
If youre looking for the alfred implementation of fly, checkout https://github.com/Apollorion/fly-alfred
110
+
If you're looking for the alfred implementation of fly, checkout https://github.com/Apollorion/fly-alfred (depreciated).
0 commit comments