fig icon indicating copy to clipboard operation
fig copied to clipboard

Aliases not useable from within functions

Open jkworth opened this issue 1 year ago • 5 comments

Sanity checks

  • [X] I have searched github.com/withfig/fig/issues and there are no duplicates of my issue
  • [X] I have run fig doctor in the affected terminal session
  • [X] I have run fig restart and tested again (tell us if that fixed it)

Issue Details

Description:

My expectations are that I should be able to call/use an alias from within a function. Just as I can using normal bash/zsh.

What happens is that it does not know the aliases exists when called from within a function.

Steps:

  1. Create the following aliases
    • Name: figtest Command: echo "testing..."
    • Name: figtest2 Command: figtest
    • Name: figtest3 Command: figtestfn "testing alias to function"
  2. Create the following functions
    • Name: figtestfn Command: echo $1
    • Name: figtestfn2 Command: figtestfn "testing function to function"
    • Name: figtestfn3 Command: echo "testing function to alias" && figtest
  3. Run any of the aliases and they run perfectly as expected
  4. Run the first 2 functions and they also run as expected
  5. Run the last function and it fails saying that the figtest command was not found

Video showing steps as well

https://user-images.githubusercontent.com/7863352/193305392-9bbadf09-cc52-424c-81c7-a329cfe73e83.mp4

Environment

fig-details:
  - desktop-version: Version 1.0.61 (B528) [U.S.]
hardware-info:
  - model: MacBook Pro
  - model-id: MacBookPro16,1
  - chip-id: 
  - cores: 6
  - mem: 16 GB
os-info:
  - macOS 12.6.0 (21G115)
environment:
  - shell: /bin/zsh
  - terminal: terminal
  - cwd: /Users/jkillingsworth
  - exe-path: /usr/local/bin/fig
  - install-method: unknown
  - env-vars:
    - FIG_INTEGRATION_VERSION: 8
    - FIG_TERM: 1
    - FIG_TERM_VERSION: 5.2.0
    - PATH: /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Applications/Postgres.app/Contents/Versions/latest/bin:/Users/jkillingsworth/.fig/bin:/Users/jkillingsworth/.local/bin:
    - SHELL: /bin/zsh
    - TERM: xterm-256color
    - TERM_SESSION_ID: 22655D1F-A847-4D80-ABA0-64553812092E
    - FIG_PID: 14703
- integrations:
  - SSH: false
  - TMUX: false
  - iTerm: application is not present.
  - Hyper: application is not present.
  - Visual Studio Code: installed!
  - Docker: false

jkworth avatar Sep 30 '22 15:09 jkworth

I believe this is supported already, although perhaps we should change the default ordering.

You can manually control the order that blocks are sourced, by clicking "View by" > "Source Order". Screen Shot 2022-09-30 at 7 53 11 PM

mschrage avatar Oct 01 '22 02:10 mschrage

Let me know if this doesn't resolve the issue for you.

mschrage avatar Oct 01 '22 02:10 mschrage

I had tried that but did not show it. I put a video together to show it in the suggested sort order and even moved the alias around in the order and still was not able to get it to work. here is a clip of using the source order and moving the alias around

https://user-images.githubusercontent.com/7863352/193412072-2cd09699-33a1-4a9b-9440-16f47c4298a6.mp4

jkworth avatar Oct 01 '22 13:10 jkworth

Both of the mp4 files you've sent seem to be corrupted. (Or at least, I cannot seem to play them). How are you taking the recordings?

mschrage avatar Oct 01 '22 22:10 mschrage

I use KAP to do the recordings. My team uses it all the time to get gifs and mp4s to post to slack, jira, and github. Granted we all are using Macs so that may make a difference.

I have downloaded the mp4s and posted them to my youtube. Here are links to both for you.

https://youtu.be/BMMZaMXSJ0c - First video using default sorting in the app https://youtu.be/3NHxMbGTWII - Second video using source order sorting in the app

Hope both of these work for you.

jkworth avatar Oct 02 '22 12:10 jkworth