GithubHelp home page GithubHelp logo

Pass bash options through bass about bass HOT 5 CLOSED

edc avatar edc commented on June 20, 2024
Pass bash options through bass

from bass.

Comments (5)

edc avatar edc commented on June 20, 2024 1

This diff works for me:

index f35a35a..73789aa 100644
--- a/functions/__bass.py
+++ b/functions/__bass.py
@@ -9,6 +9,7 @@ To be used with a companion fish function like this:

 from __future__ import print_function

+import os
 import json
 import subprocess
 import sys
@@ -37,6 +38,8 @@ def gen_script():
         divider,
     )
     args = [BASH, '-c', command]
+    if os.environ['INTERACTIVE_FISH'] == '1':
+        args.insert(1, '-i')
     output = subprocess.check_output(args, universal_newlines=True)
     stdout, new_env, alias = output.split(divider, 2)
     new_env = new_env.strip()
diff --git a/functions/bass.fish b/functions/bass.fish
index e88fdcb..8d91983 100644
--- a/functions/bass.fish
+++ b/functions/bass.fish
@@ -1,4 +1,8 @@
 function bass
+  if status --is-interactive
+    set -x INTERACTIVE_FISH 1
+  end
+
   set __bash_args $argv
   if test "$__bash_args[1]_" = '-d_'
     set __bass_debug

from bass.

edc avatar edc commented on June 20, 2024

I am confused. You use bass with fish, so your current shell is fish, and it does not make sense to pass fish's shell option to bash, right? Could you give a concert example to help me understand the use case?

from bass.

iamogbz avatar iamogbz commented on June 20, 2024

I was thinking of translating fish status to bash options. It might not be possible but an example is; when status --is-interactive then $- in the bash script should have the -i option available.

from bass.

edc avatar edc commented on June 20, 2024

A general solution would require quite some work. If all you need is the -i option, I suggest you fork this and do:

  1. read status --is-interactive in bass.fish and set an environment variable when you detect the shell is interactive, and
  2. in __bass.py, check the environment variable, and if it is set, then invoke bash with -i option.

from bass.

iamogbz avatar iamogbz commented on June 20, 2024

Thanks! Will try this out. Still think it'd be useful to for bass to pass the interactive and login options at least.

from bass.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.