Skip to content

Collection of scripts to setup the a-Shell terminal app

License

Notifications You must be signed in to change notification settings

churris-x/a-shell.scripts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A-Shell .scripts

This is a collection of setup scripts and dotfiles for the a-shell terminal app for iOS.

Getting started

  1. Download and install the app from the app store
  2. Clone this repository using the builtin git library libgit2
lg2 clone https://github.com/churris-x/a-shell.scripts .scripts
  1. Run setup.sh script
sh .scripts/setup.sh

Your home directory ~/Documents should look like this

[Documents]$ tree -a -L 1
.
├── .aliases        # symlink
├── .gitconfig      # symlink
├── .profile        # symlink
└── .scripts        # git repo

The setup script automatically sets a "theme", but this can be changed in the file or with the native config command.

Check the a-shell docs on how to set up the $PS1 (Prompt String One / Primary prompt variable)

See the Git section for how to set up access to private repos

Use

The main thing this repository does is create and manage three general dot files, .profile, .aliases and .gitconfig. This is done by creating symbolic links to each of those files in the root folder, so the files can be portable and kept up to date.

  • .profile : for now just sources the .aliases file
  • .aliases : stores all aliases commands & functions (see below how functions work)
  • functions/ : folder for script files that work as aliases
  • .gitconfig : general config such as username

To add aliases simply edit the alias file and run src to source it.

Caveats

In iOS you cannot modify the ~/ folder directly so a-shell has made the compromise of treating ~/Documents as the root folder. This applies to scripts and dotfiles.

The shell that is being run is actually dash, this causes a number of bash scripts and configs to fail, beware! (echo -e, function, string replacement, for example are all unsupported).

I recommend using the fantastic util shellcheck with a #!/bin/dash heading to help porting scripts.

The actual git command is not installed and is using the default libgit2, which I've aliased for comfort reasons. Read more on the Git section.

Aliases

According to this issue it is possible to add a .profile file that gets run and set up aliases.

So far I have not been able to add function declarations directly into the aliases file. The alternative seems to be to create a separate file for each function and then alias the running of said file, eg:

alias myfunc='sh ~/Documents/.scripts/myfunc.sh'

Git

The version of libgit2 that is being used is 1.1.0, from 2020, make sure to check the docs of that specific version if certain expected commands are missing / not working. For example git branch, git reset @~, git log --oneline, --graph or --color do not work.

There is a section on the a-shel docs for setting up ssh access to git, but if like me you want to use a classic token / fine grained from github, this is not so easy. So far I could not figure out how to add the token on the global gitconfig from a file, something like:

[user]
    password = ~/Documents/.token

would be ideal, but I didn't get the syntax correct or it's a compatibility issue with libgit2.

Best way to do it is to configure it locally for the repo, so vim .git/config and add the token as a password field directly eg: password = asdfjklj23k432...

Obsidian

My main use of this app is to keep my obsidian vault synced since I store it on github. The following are instructions first posted on this Obsidian reddit post:

  1. Install the obsidian app and create one test vault
  2. Use the built-in pickFolder command and search for the obsidian folder, then press done. Your shell should be in the obsidian Documents folder.
  3. Clone your vault repo with git clone <github link>
  4. On the Obsidian app select the new folder as a vault
  5. (Optional) You can also install the Git plugin from the community plugin section to automatically keep things updated every so often

N.B.

All of this was cobbled together from my personal bash configs, and as such not all the aliases and commands are tested and working as intended. Please check any code you are running before doing so. Have fun!

About

Collection of scripts to setup the a-Shell terminal app

Topics

Resources

License

Stars

Watchers

Forks

Languages