Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

xxh.fish seamless mode script #8

Open
anki-code opened this issue Apr 1, 2020 · 5 comments
Open

xxh.fish seamless mode script #8

anki-code opened this issue Apr 1, 2020 · 5 comments

Comments

@anki-code
Copy link
Member

Examples to start:

For community:
⬇️ Please click the 👍 reaction instead of leaving a +1 or 👍 comment

@anki-code anki-code transferred this issue from xxh/xxh Apr 2, 2020
@anki-code
Copy link
Member Author

@frederickjh could you please create xxh.fish file for seamless mode?

@frederickjh
Copy link
Contributor

I am not sure I totally understand seamless mode. I have read the description and looked at the files for the other shells.

What all needs to be moved to the remote host or configured in the file xxh.fish for seamless mode?

@anki-code
Copy link
Member Author

In short: seamless mode script just get environment variables which described in env files in plugins and add it as base64 encoded +heb arguments to xxh. For example if you have fish theme with FISH_THEME environment variable you can create xxh plugin for your theme ans add FISH_THEME to env file. When you run source xxh.fish the FISH_THEME variable will be on host and you will be in your lovely theme.

What seamless mode script do:

  1. Find env file in the plugins
  2. Get the environment variable names from env file
  3. Create the variable init code in fish syntax and encode to base64
  4. Create bash export code (it should be bash for all shells) for variable with name <plugin_name>_EXE_<variable)_name>
  5. base64 encode this export code
  6. Add +heb argument
  7. Run xxh with +heb arguments

I think the main question here is step 3 because bash command declare -p <variable> returns valid bash code to create <variable>. I don't know the analog in fish. In fact we should get the variable and create the fish code to init it with saving the type of variable. For example for xonsh I used repr function.

  1. And the final step is to read environment variables on the host and eval the code.

The description is looks tricky :) I understand if you haven't enough time and you don't need this I will not force you )

Here is the seamless mode demo for bash - https://asciinema.org/a/314508

@frederickjh
Copy link
Contributor

👌 I still don't understand all that but I did understand what you are missing.

I think that the Fish shell equivalent to declare -p is set . Just running set will list all variables. Running set -S shows information about the variables. I don't see one command that does this all together.

@anki-code
Copy link
Member Author

anki-code commented Apr 3, 2020

It's helpful! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants