PageSourceSearch

https://chenxing-dev.github.io/assets/Terminal-DDjm4gPq.js

js chenxing-dev.github.io collected 2026-10-03 08:47:12 UTC 4,434 bytes, 6 lines download raw bytes

1import{d as j,w as A,x as b,b as r,c as a,F as k,r as C,f as i,t as m,y as $,z as D,A as L,B as O,u as V,j as c,C as T,l as E,v as H}from"./index-Cd0kFkzY.js";const K={key:0,class:"inline text-nowrap"},N={class:"terminal-prompt mr-2 text-nowrap"},R={class:"text-wrap"},z={key:1,class:"terminal-file-list grid grid-cols-4"},F={key:0,class:"text-blue-400 mr-1"},G={key:1,class:"text-yellow-300 mr-1"},M={key:2,class:"terminal-output"},P={class:"terminal-line flex"},W={class:"terminal-prompt mr-2 text-nowrap"},I=j({__name:"Terminal",setup(U){const{settings:g}=A(),p=c(""),u=c([{type:"output",text:"Welcome to 陈刑OS Terminal!"},{type:"output",text:'Type "help" for available commands'}]),d=c(null),h=c(null),l=c([]),y=T(()=>l.value.length>0?`~/${l.value.join("/")}`:"~"),_=t=>T(()=>`[${t}] $`),B=c({name:"~",type:"dir",children:[{name:"readme.md",type:"file",content:["# ChenXing OS ~","A handcrafted personal web desktop built with Vue 3 + Vite.","","Try: `help`, `ls`, `cd projects`, `cat about.txt`.","Have fun hacking around."].join(`
2`)},{name:"about.txt",type:"file",content:"陈刑OS is a personal web desktop. Built with Vue 3, curiosity, and caffeine."},{name:"contact.txt",type:"file",content:`微博: @陈刑很刑
3GitHub: chenxing-dev`},{name:"projects",type:"dir",children:[{name:"arduino.txt",type:"file",content:`Arduino RGB Lighting Controller
4Stack: C++ / Arduino
5Link: https://github.com/chenxing-dev/arduino-rbg-light`},{name:"blog.txt",type:"file",content:`Personal Blog (Astro + Markdown). Drafting long-form thoughts on learning & tools.
6Link: https://blog.chenxing.dev`}]},{name:"stars.txt",type:"file",content:"★ ✦ ✧ ✺ ✹ ✸ ✶ ✵ ✷"}]}),x=()=>{let t=B.value.children;for(const n of l.value){const e=t.find(o=>o.name===n&&o.type==="dir"&&o.children);if(e&&e.children)t=e.children;else return[]}return t},w=()=>{E(()=>{d.value&&(d.value.scrollTop=d.value.scrollHeight)})};b(u,()=>{w()},{deep:!0}),b([d,h],()=>{var t;(t=h.value)==null||t.focus()});const v={help:()=>[{type:"output",text:"Available commands: "+Object.keys(v).join(", ")}],neofetch:()=>[{type:"output",text:"[email protected]"},{type:"output",text:"os           陈刑OS v1.0"},{type:"output",text:"host       chenxing-dev.github.io"},{type:"output",text:"shell      vue-sh 3.5.13"},{type:"output",text:`theme  ${g.value.theme}`}],clear:()=>{u.value=[]},about:()=>[{type:"output",text:"陈刑OS is a personal desktop environment built with Vue.js"}],date:()=>[{type:"output",text:new Date().toLocaleString()}],echo:t=>[{type:"output",text:t?t.join(" "):""}],ls:()=>[{type:"file-list",items:x()}],cat:t=>{if(!t||t.length===0)return[{type:"output",text:"cat: missing file operand"}];const n=t[0],o=x().find(s=>s.name===n&&s.type==="file");return o?o.content?[{type:"output",text:o.content}]:[{type:"output",text:""}]:[{type:"output",text:`cat: ${n}: No such file or directory`}]},cd:t=>{if(!t||t.length===0)return[];const n=t[0];return n===".."?(l.value.length>0&&(l.value=l.value.slice(0,-1)),[]):x().some(s=>s.name===n&&s.type==="dir")?(l.value=[...l.value,n],[]):[{type:"output",text:`cd: ${n}: No such directory`}]},pwd:()=>[{type:"output",text:y.value}]},S=()=>{const t=p.value.trim();if(!t)return;const n=y.value;u.value.push({type:"command",text:p.value,cwd:n});const[e,...o]=t.split(" "),s=e.toLowerCase();if(v[s]){const f=v[s](o);f&&u.value.push(...f)}else u.value.push({type:"output",text:`Command not found: ${e}.`}),u.value.push({type:"output",text:'Type "help" for commands.'});p.value="",w()};return(t,n)=>(r(),a("div",{class:O(["terminal whitespace-pre overflow-y-auto overflow-x-hidden h-full text-wrap break-all py-2 px-4",V(g).theme]),ref_key:"terminalBody",ref:d},[(r(!0),a(k,null,C(u.value,(e,o)=>(r(),a("div",{key:o,class:"terminal-line"},[e.type==="command"?(r(),a("p",K,[i("span",N,m(_(e.cwd)),1),i("span",R,m(e.text),1)])):e.type==="file-list"?(r(),a("span",z,[(r(!0),a(k,null,C(e.items,(s,f)=>(r(),a("div",{key:f,class:"flex items-center"},[s.type==="dir"?(r(),a("span",F,"📁")):(r(),a("span",G,"📄")),i("span",null,m(s.name),1)]))),128))])):(r(),a("p",M,m(e.text),1))]))),128)),i("p",P,[i("span",W,m(_(y.value)),1),$(i("input",{class:"terminal-input bg-transparent outline-none flex-1","onUpdate:modelValue":n[0]||(n[0]=e=>p.value=e),onKeyup:L(S,["enter"]),ref_key:"inputRef",ref:h,autofocus:""},null,544),[[D,p.value]])])],2))}}),q=H(I,[["__scopeId","data-v-be2d3e14"]]);export{q as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.