{"id":18218930,"url":"https://github.com/lecrapouille/mybashprofile","last_synced_at":"2025-04-07T22:30:00.896Z","repository":{"id":115857133,"uuid":"183298540","full_name":"Lecrapouille/MyBashProfile","owner":"Lecrapouille","description":"[Config] Display an owl in your console as prompt","archived":false,"fork":false,"pushed_at":"2025-03-22T20:14:42.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-22T21:25:00.138Z","etag":null,"topics":["bash","prompt"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Lecrapouille.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-04-24T20:01:39.000Z","updated_at":"2025-03-22T20:14:52.000Z","dependencies_parsed_at":null,"dependency_job_id":"1525fe4d-ed25-4d19-91af-5c6b4cedc64a","html_url":"https://github.com/Lecrapouille/MyBashProfile","commit_stats":null,"previous_names":["lecrapouille/mybashprofile","lecrapouille/mybashprompt"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lecrapouille%2FMyBashProfile","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lecrapouille%2FMyBashProfile/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lecrapouille%2FMyBashProfile/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lecrapouille%2FMyBashProfile/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Lecrapouille","download_url":"https://codeload.github.com/Lecrapouille/MyBashProfile/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247740386,"owners_count":20988204,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bash","prompt"],"created_at":"2024-11-03T18:41:32.601Z","updated_at":"2025-04-07T22:30:00.890Z","avatar_url":"https://github.com/Lecrapouille.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# My profile\n\n## An owl in your bash\n\n![alt tag](https://github.com/Lecrapouille/MyBashPrompt/blob/master/owl.png)\n\nHere is the bash code for my console prompt. Copy/paste this code into your `~/.bashrc` file to have the same prompt as me.\n\n```bash\nRED=\"\\[\\033[0;31m\\]\"\nYELLOW=\"\\[\\033[1;33m\\]\"\nGREEN=\"\\[\\033[0;32m\\]\"\nBLUE=\"\\[\\033[1;34m\\]\"\nLIGHT_RED=\"\\[\\033[1;31m\\]\"\nLIGHT_GREEN=\"\\[\\033[1;32m\\]\"\nLIGHT_BLUE=\"\\[\\033[1;36m\\]\"\nWHITE=\"\\[\\033[1;37m\\]\"\nLIGHT_GRAY=\"\\[\\033[0;37m\\]\"\nCOLOR_NONE=\"\\[\\e[0m\\]\"\n\nfunction parse_git_branch {\n  git rev-parse --git-dir \u0026\u003e /dev/null\n  git_status=\"$(LANG=en_GB git status 2\u003e /dev/null)\"\n  branch_pattern=\"^On branch ([^${IFS}]*)\"\n\n  if [[ ! ${git_status} =~ ${branch_pattern} ]]; then\n    return\n  fi\n  branch=${LIGHT_BLUE}${BASH_REMATCH[1]}\n  sha1=${BLUE}::${LIGHT_BLUE}$(git rev-parse --short HEAD)\n\n  uptodate_pattern=\"is up to date with\"\n  ahead_pattern=\"Your branch is ahead .* by ([[:digit:]]+) commit\"\n  behind_pattern=\"Your branch is behind .* by ([[:digit:]]+) commit\"\n  untrack_pattern=\"Untracked files\"\n  staged_pattern=\"Changes to be committed\"\n  notstaged_pattern=\"Changes not staged for commit\"\n  conflict_pattern=\"Unmerged paths\"\n\n  # Repository clean\n  if [[ ${git_status} =~ ${uptodate_pattern} ]]; then\n    state=\"${GREEN}🗸 \"\n  else\n    # ahead of remote by n commits\n    if [[ ${git_status} =~ ${ahead_pattern} ]]; then\n      state=\"${state}${YELLOW}▲${BASH_REMATCH[1]} \"\n    fi\n    # behind remote by n commits\n    if [[ ${git_status} =~ ${behind_pattern} ]]; then\n      state=\"${state}${RED}▼${BASH_REMATCH[1]} \"\n    fi\n  fi\n\n  # Untracked files\n  if [[ ${git_status} =~ ${untrack_pattern} ]]; then\n    remote=\"${LIGHT_BLUE}…\"$(git ls-files --others --exclude-standard | wc -l)\n  fi\n  # Staged files\n  if [[ ${git_status} =~ ${staged_pattern} ]]; then\n    remote=\"${remote}${GREEN}✚\"$(git diff --name-only --cached | wc -l)\n  fi\n  # Files with merge conflicts\n  if [[ ${git_status} =~ ${conflict_pattern} ]]; then\n    remote=\"${remote}${RED}✖\"$(git diff --name-only --diff-filter=U --relative | wc -l)\n  fi\n  # Modified files\n  if [[ ${git_status} =~ ${notstaged_pattern} ]]; then\n    remote=\"${remote}${YELLOW}●\"$(git diff --name-status | wc -l)\n  fi\n\n  if [ \"${remote}\" != \"\" ]; then\n    remote=\"(${BLUE}${remote}${BLUE})\"\n  fi\n\n  echo \"${BLUE}(${state}${branch}${sha1}${BLUE})${remote}\"\n}\n\n########################################\n#              PROMPT                  #\n########################################\n\nfunction twtty {\n    PS1=\"\n${BLUE} ,___,\n (${LIGHT_BLUE}o${YELLOW},${LIGHT_BLUE}O${BLUE})\n/(   )\n${BLUE}-${YELLOW} ~ ~ ${BLUE}-\\${fill}${BLUE}-(${LIGHT_BLUE}\\${newPWD}${BLUE})-\n${BLUE}(${LIGHT_BLUE}\\$(date +%Hh%M)${BLUE}::${LIGHT_BLUE}\\$(date \\\"+%a %d %b %y\\\")${BLUE})$(parse_git_branch)\n${COLOR_NONE} \"\n\n    PS2=\"${BLUE}-${LIGHT_BLUE}--${COLOR_NONE} \"\n}\n\nfunction prompt_command {\n    TERMWIDTH=${COLUMNS}\n    fill=\"\"\n    newPWD=\"${PWD}\"\n    let promptsize=$(echo -n \"${PWD}++++++++++++\" | wc -c | tr -d \" \")\n    let fillsize=${TERMWIDTH}-${promptsize}\n    while [ \"$fillsize\" -gt \"0\" ]\n    do\n        fill=\"${fill}-\";\n        let fillsize=${fillsize}-1;\n    done\n\n    if [ \"$fillsize\" -lt \"0\" ]\n    then\n        let cut=3-${fillsize};\n        newPWD=\"...$(echo -n $PWD | sed -e \"s/\\(^.\\{$cut\\}\\)\\(.*\\)/\\2/\")\";\n    fi\n    twtty\n}\n\nPROMPT_COMMAND=prompt_command\n```\n\n## Git status\n\nLocal status symbols:\n\n- ●n there are n modified files.\n- ✚n there are n staged files.\n- ✖n there are n files with merge conflicts.\n- …n there are n untracked files.\n\nBranch Tracking Symbols:\n\n- ✔ the repository is up to date.\n- ▲n ahead of remote by n commits.\n- ▼n behind remote by n commits.\n\n## Open terminal in PCManFM (LXDE File Manager)\n\nCreate `~/.local/share/file-manager/actions/terminal.desktop` with the following content:\n\n```desktop\n[Desktop Entry]\nType=Action\nTooltip=Open Terminal\nName=Open Terminal\nProfiles=profile-one;\nIcon=utilities-terminal\n\n\n[X-Action-Profile profile-one]\nMimeTypes=inode/directory;\nExec=tilix -w %f\nName=Default profile\n```\n\nI'm using [Tilix](https://github.com/gnunn1/tilix) as my terminal.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flecrapouille%2Fmybashprofile","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flecrapouille%2Fmybashprofile","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flecrapouille%2Fmybashprofile/lists"}