1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
import Database from "@tauri-apps/plugin-sql";
export interface User {
username: string;
}
export const DefaultUser: User = {
username: "",
};
export interface HomeInfo {
historyCount: number;
recordCount: number;
lastSyncTime: Date;
}
export const DefaultHomeInfo: HomeInfo = {
historyCount: 0,
recordCount: 0,
lastSyncTime: new Date(),
};
export class ShellHistory {
id: string;
timestamp: number;
command: string;
user: string;
host: string;
cwd: string;
duration: number;
constructor(
id: string,
timestamp: number,
command: string,
user: string,
host: string,
cwd: string,
duration: number,
) {
this.id = id;
this.timestamp = timestamp;
this.command = command;
this.user = user;
this.host = host;
this.cwd = cwd;
this.duration = duration;
}
}
export interface Alias {
name: string;
value: string;
}
export interface Var {
name: string;
value: string;
export: boolean;
}
export async function inspectHistory(id: string): Promise<any> {
const db = await Database.load(
"sqlite:/Users/ellie/.local/share/atuin/history.db",
);
let res = await db.select("select * from history where id=$1", [id]);
return res;
}
|