Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[features]: Manage setup script #66

Open
MoYingJi opened this issue Jan 7, 2025 · 0 comments
Open

[features]: Manage setup script #66

MoYingJi opened this issue Jan 7, 2025 · 0 comments
Labels
feature | 功能 New feature or request

Comments

@MoYingJi
Copy link
Collaborator

MoYingJi commented Jan 7, 2025

Features Describe | 功能描述

将需要用户手动添加至profile.bashrc等的代码单独提取出来
像 zoxide、thefuck、fzf
Extract the code that requires users to manually add it to 'profile' or '. bashrc' separately
Like zoxide, thefuck, fzf

Usage Scenario | 需求背景/使用场景

方便用户不用每次profile变更都去更改
方便程序统一自动添加、修改、删除、检测
Convenient for users to not have to change their profile every time it changed
Convenient for unified automatic addition, modification, deletion, and detection of programs

Maybe Solutions | 可能的实现方案 - (if you are developer)

创建一个目录 profiles
mkdir profiles

profiles
├── bash
│   ├── profile_a
│   └── profile_b
├── fish
│   └── profile_a
└── zsh
│   └── profile_a

提示用户将 xlings init | source 添加至 .bashrc 等文件内
程序根据使用的 shell 输出代码
Prompt users to add xlings init | source to files such as .bashrc
The program outputs code based on the shell used

profile_a、profile_b:可以代表不同的程序、不同的功能
一个功能的实现修改了 不需要检测其他部分 修改此功能的profile即可
profile_a、profile_b: Can represent different programs and functions
The implementation of a function can be modified without detecting other parts. Changing the profile of this function is sufficient

内部可以有一些逻辑 如
zsh 缺失 profile_b 但 zsh 兼容 bash,日志记录警告 并执行 bash 的 profile_b
fish 也缺失 profile_b 但 fish 不兼容 bash,输出错误并跳过执行
如果只想让 bash 执行 profile_b 而 zsh 不执行 则创建 zsh/profile_b 空文件
There may be some internal logic, such as
zsh is missing profile_b, but zsh is compatible with bash, logging warnings and executes bash/profile_b
fish is also missing profile_b, but it is not compatible with bash, resulting in output errors and skipping execution
If you only want bash to execute profile_b without zsh executing it, create an empty zsh/profile_b file

检测可以这样 调用的时候加一个 INVOKED_XLINGS_PROFILE=1 环境变量然后检测就行了
Add an INVOKED_XLINGS_PROFILE=1 variable and when I want to check if the user has executed the setup script then detect it

Additional context | 额外补充

@MoYingJi MoYingJi added the feature | 功能 New feature or request label Jan 7, 2025
@Sunrisepeak Sunrisepeak moved this to Ready in Xlings-Dev-Kanban Jan 7, 2025
Sunrisepeak added a commit that referenced this issue Jan 10, 2025
- #66

1. independent xlings profile
2. auto config for local shell

Signed-off-by: sunrisepeak <speakshen@163.com>
Sunrisepeak added a commit that referenced this issue Jan 10, 2025
- #66

1. independent xlings profile
2. auto config for local shell

Signed-off-by: sunrisepeak <speakshen@163.com>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
feature | 功能 New feature or request
Projects
Status: Ready
Development

No branches or pull requests

1 participant