{"id":18469599,"url":"https://github.com/christarazi/pushpopdir","last_synced_at":"2025-10-05T20:06:15.763Z","repository":{"id":78435901,"uuid":"48773990","full_name":"christarazi/pushpopdir","owner":"christarazi","description":"An alternative take on the pushd/popd utlilties -- C++ CLI program that uses a global stack to store the directories","archived":false,"fork":false,"pushed_at":"2017-08-12T03:43:13.000Z","size":44,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-09T06:48:13.393Z","etag":null,"topics":["cpp","ipc","popd","pushd","shared-memory","stack"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/christarazi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2015-12-30T00:59:33.000Z","updated_at":"2017-03-13T04:47:51.000Z","dependencies_parsed_at":"2023-04-10T15:01:35.856Z","dependency_job_id":null,"html_url":"https://github.com/christarazi/pushpopdir","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/christarazi/pushpopdir","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christarazi%2Fpushpopdir","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christarazi%2Fpushpopdir/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christarazi%2Fpushpopdir/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christarazi%2Fpushpopdir/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/christarazi","download_url":"https://codeload.github.com/christarazi/pushpopdir/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christarazi%2Fpushpopdir/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278510931,"owners_count":25999005,"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","status":"online","status_checked_at":"2025-10-05T02:00:06.059Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["cpp","ipc","popd","pushd","shared-memory","stack"],"created_at":"2024-11-06T10:11:01.223Z","updated_at":"2025-10-05T20:06:15.711Z","avatar_url":"https://github.com/christarazi.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pushpopdir\nA pushd/popd-like utility designed to behave exactly like `pushd` and\n`popd` except with a global stack.\n\nThe stack is not bound by a terminal process unlike the original commands. You\ncan push a directory from one terminal process and pop it into another. I\ndeveloped this because it comes in handy when I have multiple terminals open.\n\n## Info\n\n- Utilizes IPC in form of shared memory. The stack is stored in shared memory\nwhich makes it \"global\".\n- The stack is set to a max of `100` elements.\n- To make the popping utility work, a function in `.bashrc` needs to be added.\nThis is because the popping utility outputs the directory it has popped and a\nchild process (popping utility) cannot change the parent process's (terminal)\nworking directory. Therefore, we need to add a function to `.bashrc` so that\nthe terminal can capture the output of the popping utility and `cd` into it.\nSee more [here](http://unix.stackexchange.com/questions/14721/changing-current-working-dir-with-a-script).\n\n## Installation\n\n### Dependencies\n\n - g++\n - make\n - bash (`configure.sh` is a bash script)\n\nThe default installation assumes bash is the default shell, but it is not a\nrequirement.\n\n```shell\n$ ./configure.sh\n```\n\nThis will compile and install the tool. You will need sudo privileges for the\ndefault installation directory. Then add the function below to your shell's\nconfiguration file.\n\n**Note:** If you are using a different shell other than `bash`, please add the\nfunction above to your shell's respective configuration file, i.e. if you\nare using `zsh`, then it would go in `.zshrc`.\n\n```shell\n# Function for wrapping the output of global_pop_dir so we can cd.\nfunction gpopdir() {\n\tif [ \"$#\" -eq 0 ]\n\tthen\n\t\tcd \"$(global_pop_dir)\"\n\telse\n\t\tglobal_pop_dir \"$@\"\n\tfi\n}\n```\n\n## Usage\n\n```shell\n$ gpushdir \u003cdirectory\u003e     # Push a directory onto the stack.\n$ gpushdir -r              # Deallocate the shared memory (stack).\n$ gpopdir                  # Pop a directory from the stack and `cd` into it.\n$ gpopdir -l               # List contents of the stack from top to bottom.\n```\n\n## Todo\n\n- ~~Remove the `-r` option and implement the deallocation of the shared memory\nwhen the stack is being popped when empty.~~ No need for this as it can be\nused to clear the stack.\n- ~~Add ability to list the contents of the stack.~~\n- ~~Add ability to clear the stack.~~ Deallocating the stack already does\nthis.\n- Add ability to have multiple stacks.\n- Include `-u` option for automatic updating of the program.\n\n## Contribution\n\nPlease fork and submit a pull request. If you find a bug, submit an issue. I\nwelcome feedback as well.\n\n## License\n\nThis program is free software, distributed under the terms of the [GNU] General\nPublic License as published by the Free Software Foundation, version 3 of the\nLicense (or any later version).  For more information, see the file LICENSE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchristarazi%2Fpushpopdir","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchristarazi%2Fpushpopdir","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchristarazi%2Fpushpopdir/lists"}