1
1
import projects from "$lib/data/projects" ;
2
+ import { getRing } from "$lib/data/ring" ;
2
3
import socials from "$lib/data/socials" ;
3
4
import { showHelp } from "$lib/terminal/help" ;
4
5
import { writable , type Writable } from "svelte/store" ;
@@ -20,6 +21,8 @@ interface Cmds {
20
21
} ;
21
22
}
22
23
24
+ const ring = getRing ( window . location . host ) ;
25
+
23
26
export const cmds : Cmds = {
24
27
help : {
25
28
help : "List all available commands" ,
@@ -162,6 +165,76 @@ export const cmds: Cmds = {
162
165
}
163
166
]
164
167
} ,
168
+ ring : {
169
+ help : "View the ring" ,
170
+ func : ( args , input ) => {
171
+ output . update ( ( prev ) => [
172
+ ...prev ,
173
+ {
174
+ inp : input ,
175
+ res : `You're viewing the ${ makeHyperlink ( ring . name , ring . base ) } . Use the options to navigate.`
176
+ }
177
+ ] ) ;
178
+ } ,
179
+ opts : [
180
+ {
181
+ opts : [ "-o" , "--open" ] ,
182
+ help : "Opens the ring" ,
183
+ func : ( args , input ) => {
184
+ output . update ( ( prev ) => [
185
+ ...prev ,
186
+ {
187
+ inp : input ,
188
+ res : `Opening ${ makeHyperlink ( ring . name , ring . base ) } ...`
189
+ }
190
+ ] ) ;
191
+ window . open ( ring . base , "_blank" ) ;
192
+ }
193
+ } ,
194
+ {
195
+ opts : [ "-n" , "--next" ] ,
196
+ help : "Go to the next ring" ,
197
+ func : ( args , input ) => {
198
+ output . update ( ( prev ) => [
199
+ ...prev ,
200
+ {
201
+ inp : input ,
202
+ res : `Opening the next ring...`
203
+ }
204
+ ] ) ;
205
+ window . open ( `${ ring . base } /${ ring . next } ` , "_blank" ) ;
206
+ }
207
+ } ,
208
+ {
209
+ opts : [ "-p" , "--previous" ] ,
210
+ help : "Go to the previous ring" ,
211
+ func : ( args , input ) => {
212
+ output . update ( ( prev ) => [
213
+ ...prev ,
214
+ {
215
+ inp : input ,
216
+ res : `Opening the previous ring...`
217
+ }
218
+ ] ) ;
219
+ window . open ( `${ ring . base } /${ ring . previous } ` , "_blank" ) ;
220
+ }
221
+ } ,
222
+ {
223
+ opts : [ "-r" , "--random" ] ,
224
+ help : "Go to a random ring" ,
225
+ func : ( args , input ) => {
226
+ output . update ( ( prev ) => [
227
+ ...prev ,
228
+ {
229
+ inp : input ,
230
+ res : `Opening a random ring...`
231
+ }
232
+ ] ) ;
233
+ window . open ( `${ ring . base } /${ ring . random } ` , "_blank" ) ;
234
+ }
235
+ }
236
+ ]
237
+ } ,
165
238
echo : {
166
239
help : "Prints the given text" ,
167
240
func : ( args , input ) => {
0 commit comments