Why is it when I create a `.bike` file from shell, it will show extension in app

I have this fish function:

function createOrOpenBikeFile
    set bike_file (find . -name "*.bike" | head -n 1)
    if test -n "$bike_file"
        open -a "Bike" "$bike_file"
    else
        set dir_name (basename (pwd))
        set new_file "$dir_name.bike"
        touch "$new_file"
        open -a "Bike" "$new_file"
    end
end

This basically in current folder, either opens a .bike file or if it does not find any .bike file, it will create a .bike file where name is the folder name I am currently in.

This works great except one thing. If I do create a .bike file this way, via this touch command. When it gets opened I see this on top:

However if I create a file via cmd+n in app itself like so:

I will see this:

No .bike shown on top in window name.

How can I achieve latter behavior with the creation of the file from terminal?

Thank you.

I think that preference must be stored in the file system in xattr. Generally I think this is private Finder setting, maybe stored in com.apple.FinderInfo. There’s probably some way you can set that value from terminal, but I’m not sure how. Starting point might be this article:

1 Like